Im new in matlab programming and I have small issue.
I want to draw a plot 3d of Euclidean distance function for 2 coordinates, like in this picture below:
Could you help me with the source code? How I can draw this plot?
My first thoughts was wrong:
[A] = meshgrid(-100:.5:100, -100:.5:100);
D1 = bwdist(A);
figure
surf(double(A), double(D1))
It is done like this...
[x, y] = meshgrid(-100:.5:100, -100:.5:100);
The you have to calculated the euclidean distances. I assume you want them with the origin.
z = (x.^2 + y.^2).^0.5; % square root of sum of squares (euclidean distance with origin)
surf(x, y, z);
NOTE: meshgrid(-100:.5:100, -100:.5:100) might make the resolution of the plot too high. If you have trouble viewing the plot, reduce the resolution.
Use [x, y] = meshgrid(-100:5:100, -100:5:100);