animate_fields(dim, varargin)

版本 2.0.0.0 (22.5 KB) 作者: Daniel Simmons
Watch your time dependant signal play in Matlab with media controls.
266.0 次下载
更新时间 2015/12/3

查看许可证

When working with signals or fields that vary in time, it is often useful to visualize those fields using animations. This function takes 1-dimension or 2-dimension time dependant variables and animates them in Matlab. The user is given media controls and the option to save the animation as a video file for later playback when Matlab isn't available.
animate_fields(dimension,'field name',field) will animate the "field" of a certain "dimension".
For example, the simplest case being a 1D voltage signal:
animate_fields(1,'Voltage',V)
where V is a matrix in which each row represents the voltage across the spatial domain at a certain timestep, i.e. V(:,k) will be the voltage at timestep k.
For 2D fields:
animate_fields(2,'E field',E)
where E(:,:,k) will be the 2D field at timestep k.

Additionally, any number of fields can be animated side by side.

A number of options can be controlled through the function using parameters, such as the ability to manually set the axis sizes, number of frames per second, minimum and maximum amplitudes, grid and colormap.

A more complete example to plot trigonometric functions may look like this:

animate_fields(1,'domain',domain,'grid','on', 'save','file.avi',...
'Sine',sine,...
'Cosine',cosine,...
'Tangent',tangent, 'min_amplitude',-1, 'max_amplitude',1, 'grid','off',...
'Secant',secant, 'min_amplitude',-2, 'max_amplitude',2)

This is my first submission so please feel free to email me with any improvements you might like to share!

引用格式

Daniel Simmons (2024). animate_fields(dim, varargin) (https://www.mathworks.com/matlabcentral/fileexchange/46216-animate_fields-dim-varargin), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Movie 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
2.0.0.0

Fixed bugs that were introduced with Matlab R2014b
Updated to work with Matlab from 2014b

1.0.0.0