2d scan plot in matlab
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sumera Yamin
el 29 de En. de 2021
Comentada: Sumera Yamin
el 2 de Feb. de 2021
Hi,
I want to scan over 2 quantities lets say x and y. For every value of x, I scan over a range of y and record value z for every point. So I have an (x,y) grid and have z which is an x by y matrix. How would I do a 2D plot of over such quantities. Many thanks for any lead.
0 comentarios
Respuesta aceptada
Star Strider
el 29 de En. de 2021
What your Question lacks in clarity it makes up for in obfuscation.
2 comentarios
Star Strider
el 29 de En. de 2021
Editada: Star Strider
el 29 de En. de 2021
Using that code, try this:
figure
imagesc(tally)
set(gca, 'XTick',(1:size(tally,2)), 'YTick',(1:size(tally,1)))
lix = sub2ind(size(tally), ix2, ix1);
text(ix1,ix2,compose('%d', tally(lix)), 'HorizontalAlignment','center', 'VerticalAlignment','middle')
EDIT — (29 Jan 2021 at 17:31)
Updated plot code.
Más respuestas (1)
Sumera Yamin
el 2 de Feb. de 2021
Editada: Sumera Yamin
el 2 de Feb. de 2021
2 comentarios
Star Strider
el 2 de Feb. de 2021
The imagesc function and pcolor function are significantly different.
Compare these:
figure
imagesc(tally)
set(gca, 'XTick',(1:size(tally,2)), 'YTick',(1:size(tally,1)))
lix = sub2ind(size(tally), ix2, ix1);
text(ix1,ix2,compose('%d', tally(lix)), 'HorizontalAlignment','center', 'VerticalAlignment','middle')
and:
figure
pcolor(tally)
set(gca, 'XTick',(1:size(tally,2)), 'YTick',(1:size(tally,1)))
lix = sub2ind(size(tally), ix2, ix1);
text(ix1,ix2,compose('%d', tally(lix)), 'HorizontalAlignment','center', 'VerticalAlignment','middle')
The imagesc function is defined by the centres of the squares, the pcolor function is defined by the edges of the squares, so the pcolor plot is one less in each dimension.
Ver también
Categorías
Más información sobre Annotations 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!