3d plot using matlab

3 ビュー (過去 30 日間)
faicel05
faicel05 2016 年 10 月 17 日
コメント済み: Teck Ho 2018 年 4 月 10 日
Hello everyone, I want to know how I can plot this type of chart in matlab knowing that only two of my vectors have the same length (which is far greater than five), while in the third axis I only need to mention five numbers which are [200 400 600 800 1000] as shown in the figure. Thanks in advance.

採用された回答

Kwin
Kwin 2016 年 10 月 18 日
As mentioned by Walter Roberson, you could use the function waterfall, however after testing a bit myself I found that it is a little bit annoying to get the same colors as your example. Also waterfall seems to have the downside that the start and end of each line will always end at the lowest height of the data in the z-direction.
Therefore it might be easier to just use plot3, for example:
clearvars
close all
N = 50; % number of points in the x direction.
M = 5; % number of points in the y direction.
x = linspace(0, 1, N);
y = 1 : M;
% Create somewhat similar data
[X, Y] = meshgrid(x, y);
Z1 = rand(M, N) + Y .* exp(-3*X);
Z2 = rand(M, N) + Y .* exp(-3*X);
% plot each line using a for loop
hold all
for k = 1 : M
plot3(x, y(k)*ones(1,N), Z1(k,:), 'b')
plot3(x, y(k)*ones(1,N), Z2(k,:), 'r')
end
grid on
view([50 30])
  2 件のコメント
faicel05
faicel05 2016 年 10 月 22 日
Using plot3 is exactly what i needed. thank you mate.
Teck Ho
Teck Ho 2018 年 4 月 10 日
@faicel05 would you mind elaborating on how you did that?

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 10 月 17 日
  1 件のコメント
faicel05
faicel05 2016 年 10 月 22 日
thank you for the suggestion

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

カテゴリ

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