Error using plot, vectors must be the same lengths?
2 ビュー (過去 30 日間)
古いコメントを表示
g = 9.81;
theta = pi/4;
v = 400;
tmax = ((2*v*sin(theta))/g);
[x, y, t] = projectileMotion(400, pi/4);
[dfx] = derivative(t, y);
[ddfx] = derivative(t, dfx);
plot(y, dfx, ddfx)
xlabel('Time (sec)')
ylabel('y, dy, ddy')
title('Position, Velocity and Acceleration in vertical direction')
When i do this I get the error in the title, please help. Im calling functions that I have already made.
2 件のコメント
採用された回答
Ridwan Alam
2019 年 12 月 6 日
編集済み: Ridwan Alam
2019 年 12 月 6 日
Plot() doesn't allow the syntax plot(y1,y2,y3). https://www.mathworks.com/help/matlab/ref/plot.html
If t, y, dfx, and ddfx are of same length, you can try:
plot(t,y,'r',t,dfx,'g',t,ddfx,'b');
Or use
hold on;
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!