The contour function requires Z=f(x,y); I have measured data for X,Y, and Z that are not related with a function. I get errors when I use Z as a X:1 array
2 views (last 30 days)
Show older comments
contour
I am tryong to get a contour map with excel data: The error message reuires Z to be at least a 2x2 matrix not a x:1. How do I convert the Z data to be used with the contour functions?
RA(X) DEC(Y) Peak S/N (Z)
0 -40 1.01
1 -40 1.05
2 -40 0.82
3 -40 0.94
4 -40 0.97
5 -40 0.85
6 -40 0.89
7 -40 0.94
8 -40 1.21
9 -40 2.37
10 -40 2.74
11 -40 1.65
12 -40 1.46
1 Comment
Answers (1)
Bjorn Gustavsson
on 29 May 2022
You will have to look at the scatteredInterpolant or TriScatteredInterp and possibly also its related griddata functions, check the help and documentation for those functions - they will let you re-interpolate your scattered data onto/into regularly spaced points in RA and DEC. You might also find these functions on the file exchange useful:tricontf, contour-plot-for-scattered-data and contours-for-triangular-grids.
If you have data on a regular grid you can always use the reshape functions to put your 3 variable into an [n_RA x n_DECL] grid and use the contour-function.
HTH
0 Comments
See Also
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!