How do I plot these two graphs with the array/set of inputs?
显示 更早的评论
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 个评论
Matthias
2013-4-20
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
2013-4-20
What is x ? why x is not used? please clarify your question
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!