Density Plot Discrete Points

조회 수: 14 (최근 30일)
Arian Arab
Arian Arab 2015년 12월 11일
답변: Image Analyst 2015년 12월 12일
Hello everyone, I am plotting a discrete data set with the function imagesc(x,y,z). as you know this functions colors each point (x,y) with color z on squares of edge 1. my problem is that in my data set, x and y are not integers. for example (0.1,0.1,2) and (0.2,0.2,3), can anyone kindly help me and let me know what type of function i have to use to plot this data set? It is like a temperature density plot where you have the temperature at each position T(x,y), but x and y are not integers. Thanks a lot.

답변 (2개)

Joseph Cheng
Joseph Cheng 2015년 12월 11일
편집: Joseph Cheng 2015년 12월 11일
take a look at the Surface Plots of Nonuniformly Sampled Data section of http://www.mathworks.com/help/matlab/visualize/representing-a-matrix-as-a-surface.html and instead of mesh when plotting you can use imagesc() or surf and change view.
or if you can change the vector/array of z into a matrix you can define the unique values of x and y. (see below if the data is easily converted into a matrix)
x = -10:.1:10;
y = x;
[X Y]= meshgrid(x,y);
Z = X.^2+Y.^2;
figure(1),imagesc(x,y,Z)

Image Analyst
Image Analyst 2015년 12월 12일
You can use the function scatteredInterpolant() to estimate values on a regular grid from your scattered data located at various random locations. once you have that you can use imshow() to display your new image.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by