Contourf(x,y,z) with imported data
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a set of data I would like to make a contour plot of, for some reason I keep getting theese errors:
Error using contourf (line 57)
The size of X must match the size of Z or the number of columns
of Z.
Error in WIIP (line 5)
contourf(x,y,z)
I have tried with and without transposing z and switching x and y around. Still not working. Each of the variables is calling the data correctly, so I dont know what the issue is.
Code:
num = xlsread('WSS Data.xlsx','Normal','B2:E46');
x = num(:,2:4);
y = num(2:45,:);
z = num(2:45, 2:4);
contourf(x,y,z)
The spot (1,1) is blank, but that shouldnt be an issue from what I can tell.
3 comentarios
Walter Roberson
el 18 de Jun. de 2020
num = xlsread('WSS Data.xlsx','Normal','B2:E46');
x = num(1,2:end);
y = num(2:end,1);
z = num(2:end, 2:end);
contourf(x,y,z)
Respuestas (2)
Walter Roberson
el 18 de Jun. de 2020
You need to use griddedInterpolant() or scatteredInterpolant() on the data, and contourf() the result.
darova
el 18 de Jun. de 2020
You are import data in a wrong way. Try this
num = xlsread('WSS Data.xlsx','Normal','C:E');
x = num(:,1);
y = num(:,2);
z = num(:,3);
plot3(x,y,z,'.-r')

0 comentarios
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!