Color map and shading interp not working with plot3

I am using the matlab function plot3 to plot in 3D space. I am using a matrix called x_new, a vector called T_disc and a matrix called all_out. Essentially, the x_new matrix is the discretised x-axis, however each vector within it has been multiplied by a different constant (hence why its a matrix). T_disc is the discretised t-axis, whilst all_out is the output data.
My problem is, when I try to plot this with either shading interp on some kind of color map, like this
plot3(x_new,T_disc,all_out);
shading interp
It just produces the plot in the image attached (See IMAGE ATTACHED). I would like this image to show a heat distribution just like shading interp would do.
Any thoughts?

 採用された回答

KSSV
KSSV 2020 年 2 月 11 日

1 投票

surf(x_new,T_disc,all_out);
shading interp
Shading interp works with pcolor/ surf.

3 件のコメント

Jacob Jepson
Jacob Jepson 2020 年 2 月 11 日
I see, however surf does not take 2 matrices and a vector as input, and therefore I can't use it for my problem.
KSSV
KSSV 2020 年 2 月 11 日
Why not? Convert your vector into matrix using repmat. And then use surf.
Jacob Jepson
Jacob Jepson 2020 年 2 月 11 日
編集済み: Jacob Jepson 2020 年 2 月 11 日
Thank you very much. My problem was that I had some matrix dimensions mixed up. I infact did not have to convert my vector in to a matrix; your original answer was the correct one.

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

その他の回答 (0 件)

カテゴリ

質問済み:

2020 年 2 月 11 日

編集済み:

2020 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by