How can I create a movie from the following program?

1 Ansicht (letzte 30 Tage)
MOHD
MOHD am 3 Apr. 2013
Bearbeitet: Image Analyst am 22 Nov. 2020
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 a tall times?
By using a for loop "for t = 0 : 2/7 : 2;"?
If anyone can help me in this regard, it would be a great help for me.
Thanks in advance,

Antworten (1)

Image Analyst
Image Analyst am 3 Apr. 2013
Bearbeitet: Image Analyst am 22 Nov. 2020

Kategorien

Mehr zu Sudoku finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by