- Lose the single quotes, and
- Use the plot3 function:
I have a Problem.
1 回表示 (過去 30 日間)
古いコメントを表示
x = linspace(-30,30,30001);
y = ((sin(x)) ./ (x));
plot(x,y,'-');
axis([-30 30 -.25 1])
xlabel('x')
ylabel('y')
title('Reiser Graph of sin(x) / x')
x = linspace(-20,20,20001);
y = (2 ./ ('sqrt(3+x.^2)'));
z = (-1 ./ ('sqrt(2+x.^2)'));
plot(x,y,z,'-');
Error using plot
Vectors must be the same lengths.
I am getting an error message on my second plot. Please Help
0 件のコメント
回答 (1 件)
Star Strider
2015 年 2 月 4 日
The second plot works if you:
x = linspace(-20,20,20001);
y = (2 ./ (sqrt(3+x.^2)));
z = (-1 ./ (sqrt(2+x.^2)));
plot3(x,y,z,'-');
grid on
2 件のコメント
Star Strider
2015 年 2 月 4 日
Quite definitely!
You need to plot both the independent and dependent variables together as pairs:
plot(x,y, '-', x,z,'-')
grid
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!