Interp2 and contourf -- CAN ANYONE HELP ME ?

4 views (last 30 days)
Erhan Ferdi
Erhan Ferdi on 23 Feb 2014
Commented: Erhan Ferdi on 26 Feb 2014
I have data set. I will use interp2 and contourf command.How do I get using (2-D) two dimension interpolation in "contourf" command. Can anyone help me ? (39 elements)
x = [-10 -9.5 -9 -8.5 -8 -7.5 -7 -6.5 -6 -5.5 -5 -4.5 -4 -3.5 -3 ....
-2.5 -2 -1.5 -0.5 0 0.5 1 1.5 2 2.5 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10];
y = [0.98391 0.99116 0.99551 1.00565 0.99406 0.97377 0.99406 0.98391 0.98681 0.96797....
0.95348 0.92884 0.89986 0.90565 0.93174 0.96652 1.02304 1.08681 1.14188 1.13029....
1.10420 1.09986 1.09261 1.07087 1.06942 1.05928 1.06507 1.06797 1.05203 1.05493....
1.05348 1.07522 1.06217 1.07667 1.05203 1.05058 1.05638 1.06797 1.04333];
  6 Comments
Image Analyst
Image Analyst on 24 Feb 2014
We don't know how old your MATLAB is, so tell us do you have griddedInterpolant()? If not, then do you have TriScatteredInterp()? If not then you should have griddata. Can you apply the examples in any of those functions to your situation?
Erhan Ferdi
Erhan Ferdi on 24 Feb 2014
Edited: Erhan Ferdi on 24 Feb 2014
I have r2013b version MATLAB. I newbie in MATLAB, and I have commands only griddedInterpolant.(and It has been ScatteredInterp()) I don't know to take V datas(matrix) , so I can not get the appropriate coordinate system.
((Vq = interp2(X,Y,V,Xq,Yq);%I don't take Xq Yq and V(specially this "V")
If you have a chance,can you explain with my data?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 24 Feb 2014
The x and y data that you show are not sufficient to construct the plot you ask for. You need the additional data matrix that has the values between 299.94 and 300.14. If that data matrix is 2 dimensional then you have a standard contourf() plot. If, though, the data matrix is a vector whose length is the same as x and y, then you would have a scattered plot that would have to be interpolated, and it would be that vector of data that would be "V".
When I examine your x and y values, and compare to your desired plot, it appears to me that you must have a 2D array of temperatures, and so need a standard contourf() plot.
  22 Comments
Walter Roberson
Walter Roberson on 25 Feb 2014
peaks(39) asks for a 39 x 39 matrix, not for 39 peaks.

Sign in to comment.

Categories

Find more on Contour Plots 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!