2D plot with 3D data
Mostrar comentarios más antiguos
hi,i'm newbie for Matlab.In my task,i have 256 number of x,y values. Each coordinate(x,y) has it own z value(intensity).The value of z was increase from left to right(x axis) but not increase uniformly.i would like to represent it by showing the z value in boundary,such as z=1-2,2,3,...is that possible?
Thanks for solving my problem.i can explain further if anything unclear above.
Regard. Sim.
Respuestas (3)
Jan
el 10 de Mzo. de 2011
You did not specify this, but I guess, that you want to create the output as a string.
% Test data (do they match your needs??):
z = floor(cumsum(rand(256, 256) * 2));
minz = min(z, 1);
maxz = max(z, 1);
minEQmax = (minz == maxz);
C = cell(1, 256);
for i = 1:256
if minEQmax(i)
C{i} = sprintf('%d,', minz(i));
else
C{i} = sprintf('%d-%d,', minz(i), maxz(i));
end
end
Str = ['z = ', cat(2, C{:})];
Str(end) = []; % Remove trailing comma
1 comentario
sim keng hei
el 10 de Mzo. de 2011
Matt Tearle
el 10 de Mzo. de 2011
You want a contour plot? Given that it sounds like you have vectors of data:
% Make some fake data
x = rand(256,1)*4-2;
y = rand(256,1)*4-2;
z = x.*exp(-x.^2-y.^2);
% Put data onto a grid
[qx,qy] = meshgrid(linspace(min(x),max(x)),linspace(min(y),max(y)));
F = TriScatteredInterp(x,y,z);
qz = F(qx,qy);
% Make contour plot
contour(qx,qy,qz)
To get specific contour levels, you can do:
contour(...,<vector of levels>)
sim keng hei
el 11 de Mzo. de 2011
0 votos
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!