I have constructed a 2D matrix A for Temperature as a function of position ( 1 dimensional ) & time, I want to plot a surface for Temperature( z -axis ) with x & y being position and time .
e.g : A = [ 200 300 400 500; 400 500 800 1000; 1200 1500 1600 2000] . 3 rows = 3 time steps (1 sec,2 sec, 3sec) , 4 cols = 4 position. here we have 4 points, where the temp. for the 1st point is 200 at (t=1), 400 at (t=2) , 1200 at (t=3).
I want a surface plot for the values of temperature, which is saved in the matrix. Thanks

답변 (3개)

KSSV
KSSV 2018년 6월 1일

0 개 추천

A = [ 200 300 400 500; 400 500 800 1000; 1200 1500 1600 2000] ;
t = [1 2 3] ;
pos = [100 200 400 1200] ;
pcolor(t,pos,A')

댓글 수: 4

Anshuman S
Anshuman S 2018년 6월 1일
I have 10,000 time steps, is there any command for generating a matrix starting from 1 to n ( say 10,000 ) with a difference of 1 in each value like [ 1 2 3 4 5 ...... 9999 10,000 ] ?
KSSV
KSSV 2018년 6월 1일
iwant = 1:10000 ;
Anshuman S
Anshuman S 2018년 6월 1일
The surface created using surf (t,pos,A) looks very dark . How to get color contrast in it ?
KSSV
KSSV 2018년 6월 1일
shading interp
after the plot.

댓글을 달려면 로그인하십시오.

Paridhi Yadav
Paridhi Yadav 2018년 6월 1일
편집: Paridhi Yadav 2018년 6월 1일

0 개 추천

You can do it like this, since you have not given position I have assumed (1, 2, 3, 4) to be the position.
A = [ 200 300 400 500; 400 500 800 1000; 1200 1500 1600 2000]
p = [1 2 3 4] ;
t = [1 2 3] ;
surface(p,t,A)
Aakash Deep
Aakash Deep 2018년 6월 1일

0 개 추천

Hello Anshuman,
You can just use the surf command for this. It will take care of your axis and color contrast itself.
A = [ 200 300 400 500; 400 500 800 1000; 1200 1500 1600 2000] ;
surf(A)
In this case, as the matrix is of dimension 3x4 only, so the plot will also have it's x-axis and y-axis with scale 3 and 4 but when you will create your vector of 10,000 timestamps, so I am supposing that your matrix will also have some similar dimension. So, it will do it by itself.

카테고리

질문:

2018년 6월 1일

답변:

2018년 6월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by