相关资料:
http://www.ece.northwestern.edu/local-apps/matlabhelp/toolbox/simulink/ug/title.html
Simulink基础:
Continuous Blocks VS Discrete Blocks
The standard Simulink block set includes continuous blocks and discrete blocks. Continuous blocks respond continuously to continuously changing input. Discrete blocks, by contrast, respond to changes in input only at integer multiples of a fixed interval called the block's sample time.
Discrete blocks hold their output constant(保持输出恒定) between successive sample time hits. Each discrete block includes a sample time parameter that allows you to specify its sample rate.
Examples of continuous blocks include the Constant block and the blocks in the Continuous block library.
Examples of discrete blocks include the Discrete Pulse Generator and the blocks in the Discrete block library.
Many Simulink blocks, for example, the Gain block, can be either continuous or discrete, depending on whether they are driven by continuous or discrete blocks.
许多Simulink块(例如,增益块)可以是连续的也可以是离散的,具体取决于它们是由连续的还是离散的块驱动的
A block that can be either discrete or continuous is said to have an implicit sample rate. The implicit sample time is continuous if any of the block's inputs are continuous.
The implicit sample time is equal to the shortest input sample time if all the input sample times are integer multiples of the shortest time.Otherwise, the input sample time is equal to the fundamental sample time of the inputs, where the fundamental sample time of a set of sample times is defined as the greatest integer divisor of the set of sample times.(最大公约数)。
自定义模板脚本:
通过自定义脚本,可以快速设置一些需要我们手动设置的东西。
% 操作 model 的相关函数 % new_system open_system % close_system, save_system, load_system. function new_model(model_name) % 创建并打开模型 open_system(new_system(model_name)); % 设置背景颜色 % gcs 是 get current system set_param(gcs,'ScreenColor','green'); % 设置 solver set_param(gcs,'Solver','ode4'); % 设置 target file set_param(gcs,'SystemTargetFile','grt.tlc'); % 保存模型 save_system(gcs); end
Delay Block
The Delay block outputs the input of the block after a delay.
先 in 后 out
自增1 实现(1s 增1):