⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdtdmovie.m

📁 FDTD
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FDTDMovie.m                                           %
% Program for displaying the FDTD output at             %
% various time step(stored in files) as a movie.        %
% The file name is like: BASENAME_TIMESTEP.txt          %
% Eg., EField_20.txt                                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% input the base file name
f = 'E_Field';
% input the total number of iterations
n = 500;
% input the value of time step
k = 10;
%Input x axis label
xAxisLabel = 'Y';
%Input y axis label
yAxisLabel = 'X';
%Input Plot title
graphTitle = 'E Field';
% index variable for Movie
i = 1;
% movie initialization
M = moviein(n / k);
% loop n / k times
for m = k : k : n
    % full file name
    file = [f '_' int2str(m) '.txt'];
    % load the file to A
    A = load(file);
    % pseudocolor plot
    pcolor(A); 
    % a color bar
    colorbar;
    % set equal size tick marks
    axis image;
    % Min & max value for color code
    caxis([-1e-1 1e-1]);
    % shading in interpolated format
    shading interp;
    % Grayscale-like colormaps: gray / copper / bone
    % colormap(bone);
    % colormap(gray);
    % colormap(copper);
    % set label for x axis
    xlabel(xAxisLabel);
    % set label for y axis
    ylabel(yAxisLabel);
    % title of the plot
    title([graphTitle, ' At Time Step = ', int2str(m)]);
    % store the frame for movie
    M(:, i) = getframe;
    % increment movie frame index
    i = i + 1;
% end of loop
end;
% play the movie again
% movie(M);
% End of file 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -