simulation of the electromagnetic field
3 views (last 30 days)
Show older comments
delta = 0.1;
number_of_frames = 1000;
M = moviein(number_of_frames);
for k = 1:number_of_frames,
% Coefficients
wt = k*delta;
% Component
if componenttype=='ex'
Ex_xy=((w*u_o)/h_sqr).*(modein_n.*pi/Dim_b).*...
cos(modein_m*pi*xx./Dim_a).*...
sin(modein_n*pi*yy./Dim_b).*sin((wt)-(beta.*dis_z));
[px,py] = gradient(Ex_xy,0.2,0.2);
% Clear current axes
cla;
% Quiver or velocity plot
% quiver(x,y,px,py,1);
% Create 3-D shaded surface plot
surf(x,y,Ex_xy);
shading interp;
% Capture the frame
M(:,k) = getframe;
i am currently simulating the electromagnetic wave using MATLAB. i use the command 'movie' in this simulation. My intention is to simulate the electromagnetic wave with the changing of time. Hovever, i face the following error. Can someone please suggest a solution to cope with it. Thanks in advance.
??? Error using ==> capturescreen
Figure destroyed during getframe
Error in ==> getframe at 35
x=capturescreen(varargin{:});
Error in ==> Time_field at 199
M(:,k) = getframe;
0 Comments
Answers (2)
Walter Roberson
on 12 Nov 2011
You might want to try putting in a pause() to give getframe() time to finish its work.
Mallikarjun Ishwargond
on 29 Dec 2020
delta = 0.1;
number_of_frames = 1000;
M = moviein(number_of_frames);
for k = 1:number_of_frames,
% Coefficients
wt = k*delta;
% Component
if componenttype=='ex'
Ex_xy=((w*u_o)/h_sqr).*(modein_n.*pi/Dim_b).*...
cos(modein_m*pi*xx./Dim_a).*...
sin(modein_n*pi*yy./Dim_b).*sin((wt)-(beta.*dis_z));
[px,py] = gradient(Ex_xy,0.2,0.2);
% Clear current axes
cla;
% Quiver or velocity plot
% quiver(x,y,px,py,1);
% Create 3-D shaded surface plot
surf(x,y,Ex_xy);
shading interp;
% Capture the frame
M(:,k) = getframe;
0 Comments
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!