Plotting a 2D Contour from data (A variable with its XY coordinates)
21 views (last 30 days)
I need to plot a 2D Contour form data. I have a variable called "Intensity" with 224x1 values and I have a variable called "XYAxis" with the corresponding coordinates of this Intensity (224 points (X,Y)).
What i want to do is to plot both variables, to have a contour2D with the distribution of the Intensity among the points analized (each value of Intensity corresponds to one point(X,Y).
I have tried:
But it only displays an empty plot and the axis are not those i desire (i want the contour to be like scattered).
Any idea? Maybe TriScatteredInterp()?? but i need the contour to be 2D
Thanks in advanced
Sean de Wolski on 29 Dec 2014
Edited: Sean de Wolski on 29 Dec 2014
% Synthetic Data
xy = rand(20,2);
intensity = rand(20,1);
% Interpolate to grid
interpolant = scatteredInterpolant(xy(:,1),xy(:,2),intensity);
[xx,yy] = meshgrid(linspace(0,1,10)); % replace, 0 1, 10 with range of your values
intensity_interp = interpolant(xx,yy);
You'll have to interpolate it to a grid and then call contour.