MATLAB Answers

Graph of time against angle for multiple values of theta

7 views (last 30 days)
The question is: Use MATLAB to display in one figure the effects of the angle ? on ? for h0 = 30 and h0 = 40. Assume ? /16<?<7?/16
? =((h0.^(5/2)).*2.*(tan((pi./2)-theta)).^2)./(5*a.^2.*sqrt(2*g)) where ? is time in seconds
h0(cm), a(cm) and g(cm/s^2) are constants, theta is on the x axis and tau is on the y axis. The range is pi/16 to 7pi/16 with increments of pi/16 (so 7 curves)
I would like to plot all 14 curves on the same figure (7 for when h0=30 and 7 for when h0=40) but I am unsure how to do this. Even for one value of h0, the graph is empty when I run the code.
Thank you.
h0=30;
a=1;
g=9.81*100;
for theta=pi/16:pi/16:7.*pi/16
tau=((h0.^(5/2)).*2.*(tan((pi./2)-theta)).^2)./(5*a.^2.*sqrt(2*g));
end
plot(theta,tau)

  0 Comments

Sign in to comment.

Accepted Answer

darova
darova on 8 Jan 2020
You'll have only 2 curves:
a=1;
g=9.81*100;
theta = linspace(1,7,20)*pi/16;
hold on
for h0 = [30 40]
tau = ((h0.^(5/2)).*2.*(tan((pi./2)-theta)).^2)./(5*a.^2.*sqrt(2*g));
plot(theta,tau)
end
hold off

  2 Comments

Aya Souleimani
Aya Souleimani on 8 Jan 2020
Thank you very much for your help
The 2 graphs above are for theta=pi/16 for when h0=30 and h0=40, right?
Do you know I could get more than 2?

Sign in to comment.

More Answers (1)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by