Graph of time against angle for multiple values of theta
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aya Souleimani
le 8 Jan 2020
Réponse apportée : Aya Souleimani
le 8 Jan 2020
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 commentaires
Réponse acceptée
darova
le 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 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!