Plotting a heat map using surf function

I have a 2D matrix and I want to plot a heat map. I use the following codes:
fig = surf(X,Y,F);
set(fig,'linestyle','none')
view(2)
But it displays just a plan entirely blue despite the large difference between Z values as shown in image below. How can I fix this issue?

6 comentarios

Dyuman Joshi
Dyuman Joshi el 29 de Sept. de 2023
Please attach the data you are working with.
Hi Dyuman,
I attached the image I am working on and here is my code:
clc
clear
f = imread('img.jpg');
f = im2gray(f);
f = rescale(f);
F = fft2(f);
F = abs(F);
x = (0 : size(f,2) - 1)';
y = (0 : size(f,1) - 1)';
[X, Y] = meshgrid(x,y);
fig = surf(X,Y,log(F+1));
set(fig,'linestyle','none')
view(2)
@Roohollah, The plot obtained here is different compared to the one you have attached above.
clc
clear
f = imread('img.jpg');
f = im2gray(f);
f = rescale(f);
F = fft2(f);
F = abs(F);
x = (0 : size(f,2) - 1)';
y = (0 : size(f,1) - 1)';
[X, Y] = meshgrid(x,y);
fig = surf(X,Y,log(F+1));
set(fig,'linestyle','none')
view(2)
Roohollah
Roohollah el 2 de Oct. de 2023
Yes you are right. Because in this code I used log(F+1) instead of F in calling surf function. But the problem is the same. Sorry I forgot to mention it.
Dyuman Joshi
Dyuman Joshi el 2 de Oct. de 2023
I ran the code again and plotted some data tips, and the output is still different from what you got.
Check the image attached.
Roohollah
Roohollah el 3 de Oct. de 2023
That's fine.
Thanks for your time and consideration

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Productos

Versión

R2023a

Etiquetas

Preguntada:

el 29 de Sept. de 2023

Comentada:

el 3 de Oct. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by