I am trying to create a plot for certain values. I am having troubles defining m
ID: 3808385 • Letter: I
Question
I am trying to create a plot for certain values. I am having troubles defining my range as well as creating the correct plot. I am trying to create a for loop that goes through the loop with values theta 0 through 15. There is a value v_perp defined in the loop, and I want the plot to be of theta on the x axis and v_perp on the y. I only want it to plot values if v_perp is <= 0.4*v_tot. What I have so far is below:
THIS IS FOR MATLAB PROGRAM
v_min = 16.5;
v_avg = 18;
v_max = 19.5;
x_r = 21.45;
y_r = 1.265;
for theta = 0:15
Explanation / Answer
Below mentioned code i made some changes those are mentioned in the note.
v_min = 16.5;
v_avg = 18;
v_max = 19.5;
x_r = 21.45;
y_r = 1.265;
for theta = 0:15
A = -9.81/2;
B = (v_min*sind(30))+(v_min*cosd(30)*tand(theta));
C = 1.265+21.45*(tand(theta));
y = [A B C];
t = roots(y);
t_firstvalue= t(1);
v_perp(theta+1) = (-sind(-theta)*(16.5*cosd(30)))+(cosd(-theta)*((-9.81*t_firstvalue)+(16.5*cosd(30))));
v_tot = sqrt((16.5*cosd(30)).^2+(((-9.81*t_firstvalue)+(16.5*cosd(30)))).^2);
% Store whether this point is to be plotted.
if v_perp(theta+1) > v_tot
point(theta+1) = true;
else
point(theta+1) = false;
end
end
v_perp(~point) = nan;
theta = 0:15
plot(theta,v_perp, 'r-.', 'MarkerSize', 15)
Note:
i) the t contains two values, i took on value i.e., t_firstvalue
ii) i am using if condition for the point is plotted or not.
please observe the changes.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.