フィルターのクリア

how to perform for loop;

1 回表示 (過去 30 日間)
MOHD
MOHD 2012 年 12 月 5 日
dim=64;
[kx,ky]=meshgrid(-1:2/(dim-1):1);
circ=sqrt(kx.^2+ky.^2)<1;
kx=kx/2;
ky=ky/2;
alp=asin(0.8);
k0=1/sin(alp);
k=256;
kz=sqrt(k0^2-(kx.^2+ky.^2));
Gx=sqrt(k0./kz).*((k0*ky.^2+kz.*kx.^2)./(k0*(kx.^2+ky.^2)));
Gy=sqrt(k0./kz).*((kz-k0).*kx.*ky)./(k0*(kx.^2+ky.^2));
Gz=sqrt(k0./kz).*(kx./k0);
z=-64:1:63;
[r,c]=size(z);
mz=pi*64/(256);
Ex=zeros([k,k,c]);
Ey=zeros([k,k,c]);
Ez=zeros([k,k,c]);
for jj=1:c
Ex(:,:,jj)=fftshift(fft2(exp(1i*kz*z(jj)*mz).*Gx.*circ,k,k));
Ey(:,:,jj)=fftshift(fft2(exp(1i*kz*z(jj)*mz).*Gy.*circ,k,k));
Ez(:,:,jj)=fftshift(fft2(exp(1i*kz*z(jj)*mz).*Gz.*circ,k,k));
end
I =Ex.*conj(Ex)+Ey.*conj(Ey)+Ez.*conj(Ez);
M=I(k/2,:,:);
M1=squeeze(M).';
figure(1)
imagesc((M1));colormap gray
I have problem to perform for loop operation, I used above method to perform
for loop operation. Can anyone help me to perform this for loop operation in
other method it will be great helpfor me
thanking you in advance for your kind help
  1 件のコメント
per isakson
per isakson 2012 年 12 月 5 日
Your script runs here (R2012a, 64bit, Windows7) and produces an image. I cannot see any problem.
Do you get a warning or error message? You need to be more specific.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by