Borrar filtros
Borrar filtros

how to plot gaussian filter using meshgrid Function

13 visualizaciones (últimos 30 días)
Khalid Khan
Khalid Khan el 22 de Jul. de 2017
Comentada: Sonny Revell el 21 de Feb. de 2021
To plot a function of two variables, you need to generate u and v matrices consisting of repeated rows and columns, respectively, over the domain of the function H and D. Use Matlab documentation to learn about the meshgrid function, and then use it to define u and v.
  2 comentarios
Jan
Jan el 24 de Jul. de 2017
Editada: Jan el 24 de Jul. de 2017
This looks like a homework question. If this is true, please mention this, because the another type of answers is required. 1. Submitting a solution given by someone else might be treated as cheating in your university. 2. The question contains " Use Matlab documentation to learn", and providing a solution will not support this.
Note that the reputation of this forum suffers, if the members post solutions of homeworks. Then no serious teacher will recommend to use this forum anymore. But it is another story, if you post, what you have tried so far and ask a specific question. Then the forum can assist you to solve your problem by your own.
Sonny Revell
Sonny Revell el 21 de Feb. de 2021
I feel differently. Often times the instructors are not clear or understandable and we have to "learn on our own" from examples. The obscure lecture topic became clear from the examples from this forum. You Jan have "filled in the blanks" many times for me. Perhaps you should ask the instructors to be clear on the topics. Thanks Jan.

Iniciar sesión para comentar.

Respuesta aceptada

John BG
John BG el 23 de Jul. de 2017
Hi Khalid
1.
generating U and V with meshgrid
N=4;M=4;dN=.01;dM=.01;
[U,V]=meshgrid([-N:dN:N],[-M:dM:M]);
2.
the signal
s=10;
H=exp(-1/s^2*((U-N/2).^2+(V-M/2).^2));
2.
plotting
hs=surf(U,V,H);hs.EdgeColor='none'
.
note I have extended the plot limits to [-N N] and [-M M], since the question reads [1 N] [1 M] the plot would be just a quarter 'chunk' of the cake, not including the peak
.
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
  2 comentarios
Khalid Khan
Khalid Khan el 24 de Jul. de 2017
thanks for helping me but there is one more problem. how and text on plot
Evaluate the function H and generate a mesh surface in Matlab and use the Matlab command text, place a string ‘H(u,v)’ above the peak location specified by the point (N/2,M/2,1.25).
How to evaluate H
Here Is My code for the text arrow
text(N/2,M/2,1.25,'\uparrow H(u,v)');
Help me out.
Jan
Jan el 24 de Jul. de 2017
@Khalid Khan: You draw the text at z=1.25, but the Z-axis limit is at 1.0. You can use the zlim commadn to adjust this, but it looks strange that "the peak location specified by the point (N/2,M/2,1.25)" does not seem to match the current value.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by