Variable might be set by a nonscalar operator
6 views (last 30 days)
Show older comments
what is wrong with variable theta_deg,
clc
clear
close all
%% Define varaibles
theta_deg=10:1:80; %% theta in 1 degrees increments
theta_rad=deg2rad(theta_deg);
theta_decline= 40.65;
thata_incline=18.05;
M=1; % mass, kg
g=9.81; %acceleration
m_M=0.5;
Mu_s=0.2;
Mu_k=0.15;
%F_f_k=Mu_k*M*g*cos(theta_deg); % dynamic friction force
%F_f_s=Mu_s*M*g*cos(theta_deg); % static friction force
if (10 <theta_deg) && (theta_deg<=18.05)
F_f_k=Mu_k*M*g*cos(theta_deg); % dynamic friction force, box moving upwards
end
if (18.05 <theta_deg)&&(theta_deg<=40.65)
F_f_s=Mu_s*M*g*cos(theta_deg); % static friction force, the box is still
end
if (40.6<theta_deg)&&(theta_deg<=80)
F_f_k=Mu_k*M*g*cos(theta_deg); % dynamic friction force, the box is sliding downwards
end
0 Comments
Accepted Answer
Torsten
on 1 Mar 2025
Edited: Torsten
on 1 Mar 2025
%% Define varaibles
theta_deg=10:1:80; %% theta in 1 degrees increments
theta_incline=18.05;
theta_decline= 40.65;
M=1; % mass, kg
g=9.81; %acceleration
Mu_s=0.2;
Mu_k=0.15;
theta_zone1 = theta_deg<=theta_incline;
theta_zone2 = theta_deg >theta_incline & theta_deg<=theta_decline;
theta_zone3 = theta_deg >theta_decline ;
F_f_k(theta_zone1) = Mu_k*M*g*cosd(theta_deg(theta_zone1));
F_f_k(theta_zone2) = Mu_s*M*g*cosd(theta_deg(theta_zone2));
F_f_k(theta_zone3) = Mu_k*M*g*cosd(theta_deg(theta_zone3));
plot(theta_deg,F_f_k)
grid on
3 Comments
Torsten
on 1 Mar 2025
I doesn't make sense to use different arrays for different zones for the variable theta_deg. All should be saved in one array (F_f_k) as I did above. As you can see, there are jumps in the friction force curve at theta_deg = 18.05° and theta_deg = 40.65°.
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!