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 Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by