How to get a 3D contour plot with two matrices and a vector

1 回表示 (過去 30 日間)
Jacob Jepson
Jacob Jepson 2020 年 2 月 13 日
コメント済み: Jacob Jepson 2020 年 2 月 14 日
I currently am using surf to plot the Image attached (see image of the surface plot, internetpic.jpg) . My code is;
surf(x_new',T_disc,all_out);
where x_new is a 1000x97 matrix, T_disc is a vector of length 97, and all_out is a 97x1000 matrix. Whilst the attached image is good, I would preferably like to have lines representing the data Like the second plot attached (picture of graphs with the blue lines, preferedpic.jpg).
I believe the problem is that x_new is a matrix, where as contour3 for example would prefer this to be a vector. Any suggestions?

採用された回答

darova
darova 2020 年 2 月 13 日
Use repmat to create a matrix from vector
Use plot3 to create lines
% surf(x_new',T_disc,all_out);
T_disc1 = repmat(T_disc(:),[1 1000]);
plot3(x_new',T_disc1,all_out);
  4 件のコメント
darova
darova 2020 年 2 月 14 日
You mean color or direction?
Jacob Jepson
Jacob Jepson 2020 年 2 月 14 日
Derova, I managed to solve my problem by using a loop
for i=1:2:size(s_out) %size(s_out) is the length of the T_disc1 row
plot3((x_new(:,i))',T_disc1(i,:),all_out(i,:),'b');
grid on
hold on
end
Thanks for your help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by