plot a 2D circular intensity map
Show older comments
Dear all,
i would like to plot a 2D map showing below. I have x and y coordinates and z being the intensity showing as in different scale in color.
for the areas without the datapoint, i might need to interpolate the gap.
does anyone know how i can do this?
thanks so much for your help

Accepted Answer
More Answers (1)
Please note that there are multiple methods for plotting a 2D map in MATLAB, and the most optimal approach depends on the specific characteristics of your data. I might not be able to suggest the most optimal method for plotting the graph described in your question.
Please refer to the code snippet below, which outlines one such approach for plotting a 2D map. This method utilizes `x` and `y` as coordinates, with `z` representing intensity. The snippet also includes code to interpolate the `z` values across the grid.
% Create a grid for x and y coordinates
[X, Y] = meshgrid(linspace(min(x), max(x), 100), linspace(min(y), max(y), 100));
% Interpolate z values on the grid
F = scatteredInterpolant(x', y', z');
Z = F(X, Y);
figure;
imagesc(X(1,:), Y(:,1), Z);
colormap(jet);
colorbar;
axis equal;
The following documentation links provide a deeper insight into the functions I've used in the above code snippet. Kindly refer to them for more information on how to customise the plot to your dataset:
- https://www.mathworks.com/help/matlab/ref/meshgrid.html
- https://www.mathworks.com/help/matlab/ref/scatteredinterpolant.html
- https://www.mathworks.com/help/matlab/math/interpolating-scattered-data.html
- https://www.mathworks.com/help/matlab/ref/imagesc.html
- https://www.mathworks.com/help/matlab/ref/colormap.html
Additionally, you can refer to this MATLAB Answer thread for more details: https://www.mathworks.com/matlabcentral/answers/832583-plot-x-y-2d-and-z-where-z-containing-color-intensity
Hope this helps!
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




