how to plot gaussian filter using meshgrid Function

조회 수: 27 (최근 30일)
Khalid Khan
Khalid Khan 2017년 7월 22일
댓글: Sonny Revell 2021년 2월 21일
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
Jan
Jan 2017년 7월 24일
편집: Jan 2017년 7월 24일
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 2021년 2월 21일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

John BG
John BG 2017년 7월 23일
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
Khalid Khan
Khalid Khan 2017년 7월 24일
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 2017년 7월 24일
@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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by