📄 transientmovie_harmonicfield.m
字号:
% Usage
% The complex field (Magnitude + Phase) value are in j system and i is reserved for the imaginary sign.
% You should ensure that each element of matrix Magnitude & Phase corresponds exactly to certain combination of px and py elements.
% Each row of Magnitude or Phase (from left to right) correspond to px (from px(0) to px(length(px)));
% Each column of Magnitude or Phase (from top to bottom) correspond to py (from py(0) to py(length(py)));
%
% Input arguments:
% fileName: String type. avi file name with full path and file extension.
% f: single numerical value frequency in GHz.
% px: numerical vector containing coordinates of horizontal axis in mm.
% py: numerical vector containing coordinates of longitudinal axis in mm.
% Magnitude: numerical ny*nx matrix containing filed steady-state magnitudes (actual or relative value), where nx is length of px and ny is length of py.
% Phase: numerical ny*nx matrix containing filed steady-state phases in degree, where nx is length of px and ny is length of py.
% Fig: boolean type, set it as true if you want to preview the effect of the movie.
function TransientMovie_HarmonicField(fileName, f, px, py, Magnitude, Phase, Fig)
mov=avifile(fileName,'Compression','Cinepak','fps',3);
omega=2*pi*f*1e9;
dx=px(2)-px(1);dy=py(2)-py(1);
if Fig
figure(101);
pcolor(px-dx/2, py-dy/2, real(Magnitude.*exp(i*pi*Phase/180))); shading interp;
axis tight; colormap(jet); colorbar; % hot, jet, hsv, gray, pink, cool, bone, copper
H=colorbar; set(H,'fontsize', 12);
set(gca, 'linewidth', 3, 'fontsize', 18);
xlabel('mm','fontsize',18); ylabel('mm','fontsize',18); box on
pause,close,
end
figure(101);
for t=1:32
time(t)=(t-1)/(30*f*1e9);
pcolor(px-dx/2, py-dy/2, real(Magnitude.*exp(i*pi*Phase/180+i*omega*time(t)))); shading interp;
axis tight; colormap(jet); % hot, jet, hsv, gray, pink, cool, bone, copper
% image(px-dx/2, py-dy/2, real(Magnitude.*exp(i*pi*Phase/180+i*omega*time(t))), 'CDataMapping', 'scaled'); shading interp;
% axis tight; colormap(jet); % hot, jet, hsv, gray, pink, cool, bone, copper
mark=annotation('textbox',[0.152 0.798 0.129 0.093]);
frequency=[num2str(f) ' GHz'];
set(mark,'LineStyle','none','String',frequency,'VerticalAlignment','middle','HorizontalAlignment','center','BackgroundColor',[1 1 1]);
drawnow
M=getframe;
mov=addframe(mov,M);
end
mov=close(mov);close,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -