IS THERE ANY PROBLEM IN THIS PROGRAM OF FRESNEL DIFFRACTION

Lambda=633*10^-9;
z=10*10^-3;
x=1:150;
y=1:150;
[p,q]=freqspace([1 150],whole);
[X Y]=meshgrid(p,q);
R=(X.^2 + Y.^2);
Z=exp(1i.*pi.*lambda.*z.*R);
mesh(Z);
PLZZZ HELP,I CANT FIND..... AND GIVE ME A SOLUTION

댓글 수: 2

tulika - are you saying that there is a problem, and if so, what is it? Please format your code so that it is readable. Highlight it and press the {}Code button.
Lambda=633*10^-9;
z=10*10^-3;
x=1:150;
y=1:150;
[p,q]=freqspace([1 150],whole);
[X Y]=meshgrid(p,q);
R=(X.^2 + Y.^2);
Z=exp(1i.*pi.*lambda.*z.*R);
mesh(Z);
it didn't give any result.and i have to code through freqspace function and i cant change this...plzz help me..

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

답변 (1개)

Star Strider
Star Strider 2014년 8월 9일

0 개 추천

I was able to run your code (after correcting the quotes around 'whole' and changing lambda to Lambda in your Z assignment), but it didn’t produce the results I expected.
When I went online to troubleshoot it (the Wikipedia article on Fresnel diffraction is a good source), I also discovered Fresnel diffraction in two steps on stackoverflow. You might take a look at both to see what the problem may be with your code.

댓글 수: 4

my mentor gave me a flowchart of this program and i have to code through the freqspace function.that's why....
How did you get it to run? When I ran this:
lambda=633*10^-9;
z=10*10^-3;
x=1:150;
y=1:150;
[p, q]=freqspace([1 150], 'whole');
[X Y]=meshgrid(p,q);
R=(X.^2 + Y.^2);
Z=exp(1i.*pi.*lambda.*z.*R);
mesh(Z);
I get this:
Error using mesh (line 79)
X, Y, Z, and C cannot be complex
Error in test3 (line 9)
mesh(Z);
I erased the code I used, but I probably used hold to plot the real and imag parts, and then abs to see if that made a difference. Code ran, but the plotted results weren’t as I’d expected.
plz send me your code...i want to see the difference.and how to avoid this this problem.

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

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2014년 8월 9일

댓글:

2014년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by