Making a countor map from a excel file

1 次查看(过去 30 天)
Dear all,
I have excell file with 3 coloums with some numbers. top of the each coloums there is the name of variable (say, x, y and z). Anyone could help me what will be the code to make countor from the file ?
The answer will be really helpfull.
regards-
Lemon leave

采纳的回答

Fangjun Jiang
Fangjun Jiang 2011-8-2
[Num,Txt,Raw]=xlsread('MyData.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
contour(x,y,z);
  1 个评论
Chaklader Asfak
Chaklader Asfak 2011-8-5
Hello Fangjun Jiang,
Thanks for your answer. I tried to do the same with the data but it is showing some errors: Error using ==> contour at 73
Z must be size 2x2 or greater
Other time : Error - 65
Could you please write to me what is wrong here ?
Your answer will be really helpful.

请先登录,再进行评论。

更多回答(1 个)

Friedrich
Friedrich 2011-8-5
Hi,
since contour expects a matrix I would do:
[Num,Txt,Raw]=xlsread('MyData.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
F = TriScatteredInterp(x,y,z)
[qx qy] = meshgrid(min(x):0.01:max(x),min(y):0.01:max(y))
qz = F(qx,qy);
contour(qx,qy,qz)
Maybe you have to make the steps bigger for the meshgrid command. This depends on the range of your x and y values.

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by