How to make a 3D plot from a 2D graph and a vector?

Hi, If i have some 2D plot that show me an event at time 1, 2, 3, 4... and so, and i want to plot that in a 3D diagram that show me the evolution of all the 2D plot, what i must to do! For example, i have:
x=linspace(1,100);
y=ones(1,length(x));
z=[1:9];
for i=z
eval(['y_',num2str(i),'=sin(x)+i;']);
eval(['plot(x,y_',num2str(i),')']);
hold on
end
Now, how i can have a 3D plot with all the y_1, y_2, ... ,y_9 all in one where in z,y i have the single graph and in x i have the instant 1,2,3, ... ,9, where every point are connected by a simple line?
thank you!

回答 (1 件)

TADA
TADA 2018 年 11 月 10 日
編集済み: TADA 2018 年 11 月 10 日

0 投票

y = cell(1,length(z));
for i = z
y{i} = sin(x) + i;
plot3(x, ones(1, length(x))*i, y{i});
end
And remember the rule, eval is evil...

2 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 10 日
plot3(x, ones(1, length(x))*i, y{i});
TADA
TADA 2018 年 11 月 10 日
My bad... Fixed

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

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2018b

質問済み:

2018 年 11 月 10 日

コメント済み:

2018 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by