Borrar filtros
Borrar filtros

Making a countor map from a excel file

1 visualización (últimos 30 días)
Chaklader Asfak
Chaklader Asfak el 2 de Ag. de 2011
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

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 2 de Ag. de 2011
[Num,Txt,Raw]=xlsread('MyData.xls');
x=Num(:,1);
y=Num(:,2);
z=Num(:,3);
contour(x,y,z);
  1 comentario
Chaklader Asfak
Chaklader Asfak el 5 de Ag. de 2011
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.

Iniciar sesión para comentar.

Más respuestas (1)

Friedrich
Friedrich el 5 de Ag. de 2011
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.

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by