Farrukh Shehzad
Farrukh Shehzad

Reputation: 13

how to get the correct surface plot with matlab?

I want to plot three things, alpha, temp and Ea. all of them of same length i.e. 81 this the code i use for this.

clear all
clc
alp=[xlsread('3ddata.xlsx','Sheet1','A:A')]
temp=[xlsread('3ddata.xlsx','Sheet1','B:B')];
Ea=[xlsread('3ddata.xlsx','Sheet1','C:C')];
surf([alp, temp,Ea])
axis tight
xlabel 'Alpha'
ylabel 'temp'
zlabel 'Ea'

when i get the plot the x-axis is labelled from 1 to 3 while actually it is from 0.1 to 0.9 (data) and similarly the y-axis is showed to be 1 to 80 on graph while actually it is from 374 to 394 and the same with z-axis (Ea) which is shown on graph from -600 to 200 while actually it is from -619 to -591 .. (alpha from 0.1 to 0.9 , temp from 374 to 394 and Ea from -619 to -591)

the graph is attached here http://s27.postimg.org/eiv71pftf/myplot.jpg

Upvotes: 0

Views: 270

Answers (2)

Luis Mendo
Luis Mendo

Reputation: 112769

If you want to plot Ea (z axis) as a function of alp (x axis) and temp (y axis), try

surf(alp, temp, Ea)

For this to work, the sizes would have to be something like: alp 81 x 1; temp 81 x 1; Ea 81 x 81 (giving the value for each combination of alp and temp).

Upvotes: 0

Daniel
Daniel

Reputation: 36720

The way you use surf does not really make sense. With one input argument, the whole matrix is a height map. Without having your data, I can only guess: Try plot3(alp, temp,Ea). Does this provide the right output, only missing the surface in between?

You may also try:

tri = delaunay(alp,temp);
trisurf(tri,alp,temp,Ea)

Can you provide the input data?

Upvotes: 1

Related Questions