Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How we can display images at different times by using for loop instead of following program and how we can make movie from following program?

1 visualización (últimos 30 días)
clear all;
clc;
close all;
dim=32;
[kx,ky]=meshgrid(-3:6/(dim-1):3);
circ=sqrt(kx.^2+ky.^2)<1;
r=sqrt(kx.^2+ky.^2);
alp=asin(0.95);
k0=1/sin(alp);
k=256;
kz=sqrt(k0^2-(kx.^2+ky.^2));
Gx=-1i*sqrt(k0./kz).*((k0*ky.^2+kz.*kx.^2)./(k0*(kx.^2+ky.^2)));
Gy=1i*sqrt(k0./kz).*((kz-k0).*kx.*ky)./(k0*(kx.^2+ky.^2));
Gz=1i*sqrt(k0./kz).*(kx./k0);
ph=(atan2(kx,ky)+pi);
ph=rot90(ph,3);
la=-sin(ph);
lb=rot90(cos(ph),3);
z=-128:1:127;
c = numel(z);
mz=(pi/(3*8*2*tan(alp/2)));
n = size(kx);
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*mz*z(jj)).*
(Gx.*la.*circ)-rot90(exp(1i*kz*mz*z(jj)).*Gy.*lb.*circ,3),k,k));
Ey(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*
(Gy.*la.*circ)+rot90(exp(1i*kz*mz*z(jj)).*Gx.*lb.*circ,3),k,k));
Ez(:,:,jj)=fftshift(fft2(exp(1i*kz*mz*z(jj)).*
(Gz.*la.*circ)+rot90(exp(1i*kz*mz*z(jj)).*Gz.*lb.*circ,3),k,k));
end
Ex=Ex(k/2,:,:);
Ey=Ey(k/2,:,:);
Ez=Ez(k/2,:,:);
Ex=squeeze(Ex);
Ey=squeeze(Ey);
Ez=squeeze(Ez);
Ix=Ex.*conj(Ex);
Iy=Ey.*conj(Ey);
Iz=Ez.*conj(Ez);
I=Ix+Iy+Iz;
t=0;
I1=((I).*exp(1i*pi*t));
t=(2/7);
I2=((I).*exp(1i*pi*t));
t=(2*2/7);
I3=((I).*exp(1i*pi*t));
t=(3*2/7);
I4=((I).*exp(1i*pi*t));
t=(4*2/7);
I5=((I).*exp(1i*pi*t));
t=(5*2/7);
I6=((I).*exp(1i*pi*t));
t=(6*2/7);
I7=((I).*exp(1i*pi*t));
t=7*2/7;
I8=((I).*exp(1i*pi*t));
figure(7)
subplot(2,4,1);imagesc(I1.*conj(I1)),colormap gray;axis image;axis off
subplot(2,4,2);imagesc(I2.*conj(I2)),colormap gray;axis image;axis off
subplot(2,4,3);imagesc(I3.*conj(I3)),colormap gray;axis image;axis off
subplot(2,4,4);imagesc(I4.*conj(I4)),colormap gray;axis image;axis off
subplot(2,4,5);imagesc(I5.*conj(I5)),colormap gray;axis image;axis off
subplot(2,4,6);imagesc(I6.*conj(I6)),colormap gray;axis image;axis off
subplot(2,4,7);imagesc(I7.*conj(I7)),colormap gray;axis image;axis off
subplot(2,4,8);imagesc(I8.*conj(I8)),colormap gray;axis image;axis off
% % movie(F(t))
I what to two display time dependence image of I by using for loop and how we
can make movie from this time dependence of I.
how we get all images atall times;
by using for loop t=0:2/7:2;
if anyone help me in this regard it is great help for me
thanks in advance,

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by