How do I plot these two graphs with the array/set of inputs?
Show older comments
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 Comments
Matthias
on 20 Apr 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
on 20 Apr 2013
What is x ? why x is not used? please clarify your question
Accepted Answer
More Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!