Adding third dimenstion to 2D plot

1 回表示 (過去 30 日間)
Gennaro Arguzzi
Gennaro Arguzzi 2016 年 12 月 26 日
コメント済み: Walter Roberson 2016 年 12 月 26 日
Hi everyone, I'd like to plot three functions:
x=[-20:0.001:20];
y1=sin(x);
y2=x*x+x;
y3=x*x*x;
where y1(x) starts at t=0, y2(x) at t=5 and y3(x) at t=10. The x is on the first axis, the y_i functions is on the second axes and the time t is on the third axes. How could I do it (t=-10:0.001:10)?
An example of what I want is the following:
Thank you for your time.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 12 月 26 日
x=[-20:0.001:20];
y1=sin(x);
y2=x.*x+x;
y3=x.*x.*x;
plot3(x,y1,0 * ones(size(x)))
hold on
plot3(x,y2,5 * ones(size(x)))
plot3(x,y3,10 * ones(size(x)))
hold off
  2 件のコメント
Gennaro Arguzzi
Gennaro Arguzzi 2016 年 12 月 26 日
Hi @Walter Roberson, the result is unclear, the functions are unrecognisable.
Please post the code+image in future.
Walter Roberson
Walter Roberson 2016 年 12 月 26 日
sin(x) is in the range -1 to +1. x^3 is in the range -8000 to +8000 over -20 to +20. You cannot expect to be able to recognize sin(x) in the same plot as x^3 over that range of values.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by