Error using surf plot
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a vector of x and y coordinates of the red dots in the image below
I also have a vector of the FWHM at each of these points. I want to create a heat map where at each location x,y, the value if the fwhm and uses a color map.
I thought the following would work
surf(xf,yf,fwhm);
But I get the error
Error using surf (line 57)
Z must be a matrix, not a scalar or vector.
Réponse acceptée
Thorsten
le 18 Jan 2016
You can use
K = zeros(length(yf), length(xf)); % note that yf is first, xf is second because
% zeros use row, column indexing
ind = sub2ind(yf, xf); % ... same for sub2ind
K(ind) = fwhm;
imshow(K)
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!