How do I plot these two graphs with the array/set of inputs?
Mostrar comentarios más antiguos
Hello.
I'm trying to plot 5 trajectories corresponding to Theta = 0.4, 0.6, pi/4, 1.0, 1.2
Where the given functions are
Vx=V*Cos(theta)
Vy=V*Sin(theta)-9.8
Here is my Mfile, don't think I'm right.
%Question 1 - plotting five trajectories corresponding to
% Theta = 0.4, 0.6, pi/4, 1.0, 1.2
clc;clear;
x = 0.001:6*pi
V = 120
theta = ([0.4 0.6 pi/4 1.0 1.2])
steps=size(x,2);
Vo = 0:0.01:6*pi;
Vx = V*Cos(theta)
Vy = V*Sin(theta) - 9.8
% Graph of Vx*Cos(theta)
plot(Vo,Vx,'-b','Linewidth',2)
grid on
hold on
% Graph of Vo*Sin(theta) - 9.8
plot(Vo,Vy,'-r','Linewidth',2)
hold off
Thanks for the help
2 comentarios
Matthias
el 20 de Abr. de 2013
First of all sin() and cos() have no capital letters. The big problem is that your formulars Vx=V*Cos(theta) Vy=V*Sin(theta)-9.8 are independend of x and y. When you wanted do create you vectors with 1885x5 values you only created a 1x5 vector since theta is the only vector that contributes to Vx and Vy. Vo isn't used later in the program.
If you correct your initial forumlars we could help you more. If the formulars are correct try this: plot(Vx,Vy,'-b','Linewidth',2);
Azzi Abdelmalek
el 20 de Abr. de 2013
What is x ? why x is not used? please clarify your question
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!