Graph of time against angle for multiple values of theta

조회 수: 2 (최근 30일)
Aya Souleimani
Aya Souleimani 2020년 1월 8일
답변: Aya Souleimani 2020년 1월 8일
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)

채택된 답변

darova
darova 2020년 1월 8일
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
Aya Souleimani
Aya Souleimani 2020년 1월 8일
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?
darova
darova 2020년 1월 8일
  • Do you know I could get more than 2?
You can't

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Aya Souleimani
Aya Souleimani 2020년 1월 8일
Thank you for your help

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by