simulink模块库常识
Simulink模块库简介(9)

Simulink模块库简介(9)标签: MATLAB笔记 2006-10-08 10:0413. 输入源模块(Sources)在Simulink基本模块中选择“Sources”后,单击便看到如图6.27所示的查找表模块,它包括以下子模块。
● Band-Limited White Noise:带限白噪声;● Chirp Signal:产生一个频率不断增大的正弦波;● Clock:显示和提供仿真时间;● Constant:常数信号;● Counter Free-Running:无限计数器;● Counter Limited:有限计数器;● Digital Clock:在规定的采样间隔产生仿真时间;● From File(.mat):来自数据文件;● From Workspace:来自MATLAB的工作空间;● Ground:连接到没有连接到的输入端;● In1:输入信号;● Pulse Generator:脉冲发生器;● Ramp:斜坡输入;● Random Number:产生正态分布的随机数;● Repeating Sequence:产生规律重复的任意信号;● Repeating Sequence Interpolated:重复序列内插值;● Repeating Sequence Stair:重复阶梯序列;● Signal Builder:信号创建器;●Signal Generator:信号发生器,可以产生正弦、方波、锯齿波及随意波;● Sine Wave:正弦波信号;● Step:阶跃信号;● Uniform Random N umber:一致随机数;14. 用户自定义函数模块(User-Defined Functions)在Simulink基本模块中选择“User-Defined Functions”后,单击便看到如图6.28所示的查找表模块,它包括以下子模块。
● Embedded MATLAB Function:嵌入的MATLAB函数;● Fcn:用自定义的函数(表达式)进行运算;● M-file S-Function:M文件编写的S函数;● MATLAB Fcn:利用MATLAB的现有函数进行运算;● S-Function:调用自编的S函数的程序进行运算;● S-Function Builder:S函数建立器;● S-Function Examples:S函数例子。
matlab-simulink模块库介绍

Band-Limited White Noise 给连续系统引入白噪声
Simulink 模块库——Source
Inport(输入端口)
模块功能 为子系统或外部输入创建输入端口。 模块说明 该模块将输入信号从一个系统的外部引入到系 统的内部。Simulink按照规则来指定Inport端 口的编号。 模块数据类型 该模块接受任何类型的实数或复数值信号。 模块参数对话框
生成一阶跃函数 生成一重复的任意信号 生成有着规则间隔的脉冲 产生一个频率递增的正弦波 接地 提供仿真时间 提供给定采样频率的仿真时间 从文件读取数据
From Workspace
从工作空间的矩阵中读取数据
Random Number
生成正态分布的随机信号
Uniform Random Number 生成均匀分布的随机数
Constant(常量)
模块功能 生成一常量 模块说明 Constant 模块生成一个与时间无 关的指定的实数或复数值。 模块数据类型 数据类型与模块参数Constant value 一样 模块参数对话框 常数值(Constant value)参数 是该模块的输出,它可以是具体 数值或常量名。
Simulink 模块库——Source
Band-Limited White Noise(限带 白噪声)
模块功能 给一个连续系统引入白噪声 模块说明 Band-Limited White Noise模块生成正态分布 的随机数,它适用于连续或者混合系统。它以 一定的采样率产生输出。 模块数据类型 双精度类型实数信号 模块参数对话框 Noise power:白噪声功率谱密度图的高度 Sample time:噪声相关时间(理论上为0) Seed:发生随机数的开始种子。
SIMULINK的模块库介绍

SIMULINK的模块库介绍(1)Commonly UsedBus Creator Create signal busBus Selector Select signals from incoming busConstant Generate constant valueData Type Conversion Convert input signal to specified data typeDemux Extract and output elements of vector signalDiscrete-TimeIntegratorPerform discrete-time integration or accumulation of signal Gain Multiply input by constantGround Ground unconnected input portInport Create input port for subsystem or external input Integrator,IntegratorLimitedIntegrate signalLogical Operator Perform specified logical operation on inputMux Combine several input signals into vectorOutport Create output port for subsystem or external outputProduct Multiply and divide scalars and nonscalars or multiply and invert matricesRelational Operator Perform specified relational operation on inputs Saturation Limit range of signalScope and Floating Display signals generated during simulationScopeSubsystem,AtomicSubsystem,NonvirtualSubsystem,CodeReuseSubsystemRepresent system within another systemSum,Add,Subtract,Sum of ElementsAdd or subtract inputsSwitch Switch output between first input and third input based on value of second inputTerminator Terminate unconnected output portUnit Delay Delay signal one sample period(2)ContinuousDerivative Output time derivative of inputIntegrator,IntegratorLimitedIntegrate signalPID Controller Simulate continuous-or discrete-time PID controllersPID Controller(2 DOF) Simulate continuous-or discrete-time two-degree-of-freedom PID controllersSecond-OrderIntegrator,Second-Order Integrator LimitedIntegrate input signal twiceState-Space Implement linear state-space system Transfer Fcn Model linear system by transfer function Transport Delay Delay input by given amount of time Variable TimeDelay,VariableTransport DelayDelay input by variable amount of timeZero-Pole Model system by zero-pole-gain transfer function (3)DiscontinuitiesBacklash Model behavior of system with playCoulomb and ViscousModel discontinuity at zero,with linear gain elsewhere FrictionDead Zone Provide region of zero outputDead Zone Dynamic Set inputs within bounds to zeroHit Crossing Detect crossing pointQuantizer Discretize input at specified intervalRate Limiter Limit rate of change of signalRate Limiter Dynamic Limit rising and falling rates of signalRelay Switch output between two constantsSaturation Limit range of signalSaturation Dynamic Bound range of inputWrap To Zero Set output to zero if input is above threshold(4)DiscreteDifference Calculate change in signal over one time stepDiscrete Derivative Compute discrete time derivativeDiscrete Filter Model Infinite Impulse Response(IIR)direct form II filtersDiscrete FIR Filter Model FIR filtersDiscrete State-Space Implement discrete state-space systemDiscrete Transfer Fcn Implement discrete transfer functionDiscrete Zero-Pole Model system defined by zeros and poles of discrete transfer function Discrete-TimeIntegratorPerform discrete-time integration or accumulation of signalFirst-Order Hold Implement first-order sample-and-holdInteger Delay Delay signal N sample periodsMemory Output input from previous time stepPID Controller Simulate continuous-or discrete-time PID controllersPID Controller(2 DOF) Simulate continuous-or discrete-time two-degree-of-freedom PID controllersTapped Delay Delay scalar signal multiple sample periods and output all delayed versionsTransfer Fcn FirstOrderImplement discrete-time first order transfer functionTransfer Fcn Lead orLagImplement discrete-time lead or lag compensatorTransfer Fcn RealZeroImplement discrete-time transfer function that has real zero and no pole Unit Delay Delay signal one sample periodZero-Order Hold Implement zero-order hold of one sample period(5)Logic and BitOperationsBit Clear Set specified bit of stored integer to zeroBit Set Set specified bit of stored integer to oneBitwise Operator Specified bitwise operation on inputs Combinatorial Logic Implement truth tableCompare To Constant Determine how signal compares to specified constant Compare To Zero Determine how signal compares to zeroDetect Change Detect change in signal valueDetect Decrease Detect decrease in signal valueDetect Fall Negative Detect falling edge when signal value decreases to strictly negative value,and its previous value was nonnegativeDetect Fall Nonpositive Detect falling edge when signal value decreases to nonpositive value,and its previous value was strictly positiveDetect Increase Detect increase in signal valueDetect Rise Nonnegative Detect rising edge when signal value increases to nonnegative value,and its previous value was strictly negativeDetect Rise Positive Detect rising edge when signal value increases to strictly positive value,and its previous value was nonpositiveExtract Bits Output selection of contiguous bits from input signal Interval Test Determine if signal is in specified intervalInterval Test Dynamic Determine if signal is in specified intervalLogical Operator Perform specified logical operation on input Relational Operator Perform specified relational operation on inputs Shift Arithmetic Shift bits or binary point of signal(6)Lookup TablesDirect LookupTable(n-D)Index into N-dimensional table to retrieve element,column,or 2-D matrixInterpolation Using Prelookup Use precalculated index and fraction values to accelerate approximation of N-dimensional functionLookup Table Approximate one-dimensional functionLookup Table(2-D) Approximate two-dimensional functionLookup Table(n-D) Approximate N-dimensional functionLookup TableDynamicApproximate one-dimensional function using dynamic table Prelookup Compute index and fraction for Interpolation Using Prelookup blockSine,Cosine Implement fixed-point sine or cosine wave using lookup table approach that exploits quarter wave symmetry(7)Math OperationsAbs Output absolute value of inputAlgebraic Constraint Constrain input signal to zeroAssignment Assign values to specified elements of signalBias Add bias to inputComplex toMagnitude-AngleCompute magnitude and/or phase angle of complex signal Complex to Real-Imag Output real and imaginary parts of complex input signalDivide Divide one input by anotherDot Product Generate dot product of two vectorsFind Find nonzero elements in arrayGain Multiply input by constantMagnitude-Angle toComplexConvert magnitude and/or a phase angle signal to complex signal Math Function Perform mathematical functionMatrix Concatenate,Vector Concatenate Concatenate input signals of same data type to create contiguous output signalMinMax Output minimum or maximum input valueMinMax RunningResettableDetermine minimum or maximum of signal over time Permute Dimensions Rearrange dimensions of multidimensional array dimensions Polynomial Perform evaluation of polynomial coefficients on input valuesProduct Multiply and divide scalars and nonscalars or multiply and invert matricesProduct of Elements Copy or invert one scalar input,or collapse one nonscalar input Real-Imag to Complex Convert real and/or imaginary inputs to complex signalReshape Change dimensionality of signalRounding Function Apply rounding function to signalSign Indicate sign of inputSine Wave Function Generate sine wave,using external signal as time sourceSlider Gain Vary scalar gain using sliderSqrt,SignedSqrt,Reciprocal SqrtCalculate square root,signed square root,or reciprocal of square root Squeeze Remove singleton dimensions from multidimensional signal Sum,Add,Subtract,Sum of ElementsAdd or subtract inputsTrigonometricFunctionSpecified trigonometric function on inputUnary Minus Negate inputWeighted SampleTime MathSupport calculations involving sample time(8)Model VerificationAssertion Check whether signal is zeroCheck Discrete Gradient Check that absolute value of difference between successive samples of discrete signal is less than upper boundCheck Dynamic Gap Check that gap of possibly varying width occurs in range of signal's amplitudesCheck DynamicLower BoundCheck that one signal is always less than another signalCheck Dynamic Range Check that signal falls inside range of amplitudes that varies from time step to time stepCheck Dynamic UpperBoundCheck that one signal is always greater than another signal Check InputResolutionCheck that input signal has specified resolutionCheck Static Gap Check that gap exists in signal's range of amplitudesCheck Static Lower Bound Check that signal is greater than(or optionally equal to)static lower boundCheck Static Range Check that signal falls inside fixed range of amplitudesCheck Static UpperBoundCheck that signal is less than(or optionally equal to)static upper bound(9)Model-WideUtilitiesBlock Support Table View data type support for Simulink blocksDocBlock Create text that documents model and save text with modelModel Info Display revision control information in modelTimed-BasedGenerate linear models in base workspace at specific times LinearizationTrigger-BasedGenerate linear models in base workspace when triggered Linearization(10)Ports&SubsystemsTrigger Add trigger port to model or subsystemAction Port Implement Action subsystems used by if and switch control flow statements in Simulink softwareConfigurableSubsystemRepresent any block selected from user-specified library of blocks Enable Add enabling port to subsystemEnabled and Triggered Subsystem Represent subsystem whose execution is enabled and triggered by external inputEnabled Subsystem Represent subsystem whose execution is enabled by external inputFor Each Enable blocks inside For Each Subsystem to process elements or subarrays of input signal independentlyFor Each Subsystem Repeatedly perform algorithm on each element or subarray of input signal and concatenate resultsFor Iterator Repeatedly execute contents of subsystem at current time step until iteration variable exceeds specified iteration limitFor Iterator Subsystem Represent subsystem that executes repeatedly during simulation time stepFunction-Call Generator Execute function-call subsystem specified number of times at specified rateFunction-Call Split Provide junction for splitting function-call signalFunction-CallSubsystemRepresent subsystem that can be invoked as function by another block If Model if-else control flowIf Action Subsystem Represent subsystem whose execution is triggered by If blockInport Create input port for subsystem or external inputModel Include model as block in another modelOutport Create output port for subsystem or external outputSubsystem,AtomicSubsystem,NonvirtualSubsystem,CodeReuseSubsystemRepresent system within another systemSwitch Case Implement C-like switch control flow statementSwitch Case ActionSubsystemRepresent subsystem whose execution is triggered by Switch Case block Triggered Subsystem Represent subsystem whose execution is triggered by external inputWhile Iterator Subsystem Represent subsystem that executes repeatedly while condition is satisfied during simulation time step(11)Signal AttributesSignal Specification Specify desired dimensions,sample time,data type,numeric type,and other attributes of signalBus to Vector Convert virtual bus to vectorData Type Conversion Convert input signal to specified data typeData Type Conversion Inherited Convert from one data type to another using inherited data type and scalingData Type Duplicate Force all inputs to same data typeData Type Propagation Set data type and scaling of propagated signal based on information from reference signalsData Type ScalingStripRemove scaling and map to built in integer IC Set initial value of signalProbe Output signal's attributes,including width,dimensionality,sample time,and/or complex signal flagRate Transition Handle transfer of data between blocks operating at different rates Signal Conversion Convert signal to new type without altering signal values Weighted SampleTimeSupport calculations involving sample timeWidth Output width of input vector(12)Signal RoutingBus Assignment Replace specified bus elementsBus Creator Create signal busBus Selector Select signals from incoming busData Store Memory Define data storeData Store Read Read data from data storeData Store Write Write data to data storeDemux Extract and output elements of vector signalEnvironment Controller Create branches of block diagram that apply only to simulation or only to code generationFrom Accept input from Goto blockGoto Pass block input to From blocksGoto Tag Visibility Define scope of Goto block tagIndex Vector Switch output between different inputs based on value of first input Manual Switch Switch between two inputsMerge Combine multiple signals into single signalMultiport Switch Choose between multiple block inputsMux Combine several input signals into vectorSelector Select input elements from vector,matrix,or multidimensional signalSwitch Switch output between first input and third input based on value of second input(13)SinksDisplay Show value of inputOutport Create output port for subsystem or external output Scope and FloatingDisplay signals generated during simulationScopeStop Simulation Stop simulation when input is nonzeroTerminator Terminate unconnected output portTo File Write data to fileTo Workspace Write data to MATLAB workspaceXY Graph Display X-Y plot of signals using MA TLAB figure window (14)SourcesBand-Limited WhiteNoiseIntroduce white noise into continuous system Chirp Signal Generate sine wave with increasing frequency Clock Display and provide simulation time Constant Generate constant valueCounter Free-Running Count up and overflow back to zero after reaching maximum value for specified number of bitsCounter Limited Count up and wrap back to zero after outputting specified upper limit Digital Clock Output simulation time at specified sampling interval Enumerated Constant Generate enumerated constant valueFrom File Read data from MAT-fileFrom Workspace Read data from workspaceGround Ground unconnected input portInport Create input port for subsystem or external inputPulse Generator Generate square wave pulses at regular intervalsRamp Generate constantly increasing or decreasing signalRandom Number Generate normally distributed random numbersRepeating Sequence Generate arbitrarily shaped periodic signalRepeating Sequence Interpolated Output discrete-time sequence and repeat,interpolating between data pointsRepeating SequenceStairOutput and repeat discrete time sequenceSignal Builder Create and generate interchangeable groups of signals whose waveforms are piecewise linearSignal Generator Generate various waveformsSine Wave Generate sine wave,using simulation time as time source Step Generate step functionUniform RandomNumberGenerate uniformly distributed random numbers(15)User-DefinedFunctionsEmbedded MATLABInclude MATLAB code in models that generate embeddable C code FunctionFcn Apply specified expression to inputLevel-2 M-FileUse Level-2 M-file S-function in modelS-FunctionMATLAB Fcn Apply MATLAB function or expression to inputS-Function Include S-function in modelS-Function Builder Create S-function from C code that you provide(16)AdditionalMath&DiscreteAdditional Discrete Provide additional discrete math supportAdditional Increment or decrement value of signal by oneMath:Increment—Dec rement。
SIMULINK模块介绍

Simulink 模块库——Source
Step(阶跃)
模块功能 产生一个阶跃信号 模块说明 Step 提供在指定时间处在两个可定义的水平 间的阶跃。 模块数据类型 双精度类型实数信号 模块参数对话框 Step time:发生阶越变化的时间(s) Initial value:从开始仿真达到Step time时的 模块输出值 Final value:仿真超过Step time后的输出值 Sample time:阶越采样率 当仿真时间小于Step time,则输出Initial value;当仿真时间大于或等于Step time输出 Final value.
Simulink 模块库——Source
Band-Limited White Noise(限带 白噪声)
模块功能 给一个连续系统引入白噪声 模块说明 Band-Limited White Noise模块生成正态分布 的随机数,它适用于连续或者混合系统。它以 一定的采样率产生输出。 模块数据类型 双精度类型实数信号 模块参数对话框 Noise power:白噪声功率谱密度图的高度 Sample time:噪声相关时间(理论上为0) Seed:发生随机数的开始种子。
Simulink 模块库——Source
From File(从文件读数据)
模块功能 从文件读数据 模块说明 From File模块从指定的文件读取数据作为其 输出。模块的图标中显示了提供数据的文件 名。文件名必须包含一个两行或两行以上的 矩阵,第一行应是单调递增的时间点,其它 行是与之对应的数据点。 模块数据类型 双精度类型实数信号 模块参数对话框 File name:输入数据的文件名。 Sample time:从文件中读去数据的采样率
SIMULINK 模块库
matlab-simulink模块库介绍

Simulink 模块库——Source
Clock(时钟)
模块功能 显示并提供仿真时间 模块说明 Clock模块在每一仿真步,输出当时的仿真时 间。当该模块被打开时,这一时间将显示在 窗口中。在打开该模块的情况下仿真会减慢 仿真速度。它对需要仿真时间的模块来说很 有用处。 模块数据类型 双精度类型实数信号 模块参数对话框 Display time:使用该复选框,在模块图标 旁显示当前仿真时间,并改变其图标的外观 Decimation:时间更新获取的增量,可以 是任意正整数,如取值为1000,固定积分步 为1ms,则时钟将每隔1s更新一次。
关处理; (9)Subsystems模块库,各种子系统;
Simulink 模块库——Source
模块
功能
In1
子系统输入
Constant
生成一个常量值
Signal Generator
生成变化的波形
Ramp
生成一连续递增或递减的信号
Sine Wave
生成正弦波
Step Repeating Sequence Pulse Generator Chirp Signal Ground Clock Digital Clock From File
Simulink 模块库——Source
Pulse Generator(脉冲发生器)
模块功能 以一定的间隔生成脉冲 模块说明 Pulse Generator模块以一定的间隔产生一 系列的脉冲。 模块数据类型 双精度类型实数信号 模块参数对话框 Amplitude:脉冲幅度 Period:脉冲周期(s) Pulse Width:脉冲宽度(占整个周期的百 分比) Phase delay:脉冲产生开始前的时间延 迟(s)
simulink常用模块梳理与总结

simulink常用模块梳理与总结Simulink is a powerful tool for modeling, simulating, and analyzing dynamic systems. It offers a wide variety of modules that can be used to construct complex models for various applications. These modules can be categorized into blocks, sources, sinks, continuous, and discrete blocks, among others.Simulink中常用的模块可以帮助用户快速构建复杂的系统模型,有效地进行仿真分析。
模块可以分为多种类型,如Blocks、Sources、Sinks、Continuous、Discrete等等。
不同的模块可以用于不同的应用场景,满足用户的各种需求。
Blocks are the basic components in Simulink, representing various mathematical operations, logical conditions, and signal processing functions. They can be connected together to form a block diagram that describes the system dynamics. Commonly used blocks include Sum, Gain, Integrator, and Transfer Function.Blocks是Simulink中的基本组件,代表各种数学运算、逻辑条件和信号处理功能。
用户可以将这些Blocks连接在一起,构成描述系统动态的框图。
Simulink常用模块介绍与应用技巧
V-realm Builde 2.0 界面
【例5-29】飞机围绕大树飞行
File|New 单击背景按钮
Libraries|ImportFrom|Object Library
选择:Vegetable and Plants
选择:Tree , 拖入编辑框中。
调整 scale,选择合适大小。
【例5-32】
拖入 enabled subsystem 双击模块 拖入其他模块
加上信号源,示波器
成果显示
5.6.3 模块封装技术
封装:将模块相应旳子系统内部构造隐含起来,仅 提供对话框输入,进行参数设置。
封装建立过程:首先建立子系统模块,选中该系 统模块旳图标,再选择 Edit|Mask Subsystem
第五章 Simulink 常用模块简介与应用技巧
5.1 常用模块应用技巧
5.1.1 向量化模块(Mux、Demux)举例
向量型信号:多路信号经过Mux合成一路向量信号;
【例5-1】Van der Pol (例4-2)也能够表达成向量形式:
x1 x2
(
x12
x2 1)
x2
x1
能够用单个积分器模 块来完毕向量化建模, 如右图:
Simulink 3D Animation DEMOS
【编程例子】
自编:matlab|car3d.m, 或 vrcar.m 静态:vrmount.wrl(C:\MATLAB2023a\toolbox\sl3d\sl3ddemos)
5.6 子系统与模块封装技术
子系统:将多种功能部件集合成一种功能框。 实现:选中矩形框中旳部件,选择 Edit|Create
Subsystem, 建立子系统。 系统自动设置输入输出端:流入为输入,流出为
simulink 模块参数
simulink 模块参数【1.Simulink简介】Simulink是MATLAB的一个重要工具箱,用于模拟和分析动态系统。
它为用户提供了一个基于图形的建模环境,使得用户可以方便地创建、编辑和仿真控制系统、信号处理系统等。
在Simulink中,有许多预先定义好的模块,用户可以根据需要进行组合和连接,以构建所需的系统模型。
【2.Simulink模块分类与功能】Simulink模块主要分为以下几类:1.源模块:产生输入信号,如信号发生器、文件读取器等。
2.线性模块:执行线性变换,如滤波器、放大器等。
3.非线性模块:执行非线性变换,如信号处理、逻辑运算等。
4.输出模块:将仿真结果输出,如示波器、数据记录器等。
5.连接模块:用于连接不同模块,如总线、开关等。
【3.设置模块参数的方法】在Simulink中,设置模块参数主要有以下几种方法:1.直接双击模块,弹出参数对话框进行设置。
2.在Simulink编辑器中,选中模块,点击右键选择“模块参数”进行设置。
3.使用MATLAB命令设置,如`set_param(<模块名称>,"<参数名称>",<参数值>)`。
【4.常用模块参数详解】1.信号发生器模块:如正弦信号发生器,可以设置信号频率、幅度、相位等参数。
2.滤波器模块:如低通滤波器,可以设置截止频率、通带衰减、阻带衰减等参数。
3.放大器模块:如线性放大器,可以设置输入和输出范围、增益等参数。
4.逻辑运算模块:如与门、或门等,可以设置逻辑关系、输入信号等参数。
【5.参数设置实例演示】以一个简单的滤波器为例,假设我们需要设计一个截止频率为1kHz的低通滤波器。
首先,在Simulink库中找到滤波器模块,将其放入编辑器中。
然后,双击滤波器模块,在参数对话框中设置截止频率为1kHz,通带衰减为1dB,阻带衰减为20dB。
最后,将滤波器与其他模块连接,完成滤波器系统的搭建。
Simulink4基本模块介绍
m&& + cx + kx = F x &
作 Laplace 变换,并忽略初始条件,有:
ms 2 X ( s ) + csX ( s ) + kX ( s ) = F ( s )
则系统的传递函数可表示为:
1 1/ m X ( s) G(s) = = 2 = F ( s ) ms + cs + k s 2 + c s + k m m
1/0.5 s2 Transfer Fcn
20 15 10 5 0
Scope
传递函数分子输入:1/0.5 分母输入:[1, 0, 0]
0
2
4
6
8
10
12
14
16
18
20
G ( s) =
1/ m X ( s) = F ( s) s 2 + c s + k m m
对传递函数模块的说明: 用传递函数模块对线性定常系统进行仿真,能够使仿真模型 简单和紧凑,但是无法输出内部变量,如 x 的导数. 无法适用具有初始条件的情况. 传递函数模块只适用于单输入单输出系统,即单自由度系统 ,但无法应用于多输入多输出系统,即多自由度系统.
3 7
5 9
Display
3. 微分模块 作用:计算输入对时间的变化率. 代表如下微分方程: 微分模块如图所示: 例如,对于动力学方程:
dx & y= =y dt
du/dt Derivative
&& & M x (t ) + C x (t ) + Kx (t ) = P (t )
考虑对正弦信号 sin (t) 的微分:
SIMULINK模块介绍
实验五SIMULINK仿真一、实验目的SIMULINK是一个对动态系统(包括连续系统、离散系统和混合系统)进行建模、仿真和综合分析的集成软件包,是MA TLAB的一个附加组件,其特点是模块化操作、易学易用,而且能够使用MATLAB提供的丰富的仿真资源。
在SIMULINK环境中,用户不仅可以观察现实世界中非线性因素和各种随机因素对系统行为的影响,而且也可以在仿真进程中改变感兴趣的参数,实时地观察系统行为的变化。
因此SIMULINK已然成为目前控制工程界的通用软件,而且在许多其他的领域,如通信、信号处理、DSP、电力、金融、生物系统等,也获得重要应用。
对于信息类专业的学生来说,无论是学习专业课程或者相关课程设计还是在今后的工作中,掌握SIMULINK,就等于是有了一把利器。
本次实验的目的就是通过上机训练,掌握利用SIMULINK对一些工程技术问题(例如数字电路)进行建模、仿真和分析的基本方法。
二、实验预备知识1. SIMULINK快速入门在工程实际中,控制系统的结构往往很复杂,如果不借助专用的系统建模软件,则很难准确地把一个控制系统的复杂模型输入计算机,对其进行进一步的分析与仿真。
1990年,Math Works软件公司为MATLAB提供了新的控制系统模型图输入与仿真工具,并命名为SIMULAB,该工具很快就在控制工程界获得了广泛的认可,使得仿真软件进入了模型化图形组态阶段。
但因其名字与当时比较著名的软件SIMULA类似,所以1992年正式将该软件更名为SIMULINK。
SIMULINK的出现,给控制系统分析与设计带来了福音。
顾名思义,该软件的名称表明了该系统的两个主要功能:Simu(仿真)和Link(连接),即该软件可以利用系统提供的各种功能模块并通过信号线连接各个模块从而创建出所需要的控制系统模型,然后利用SIMULINK提供的功能来对系统进行仿真和分析。
⏹SIMULINK的启动首先启动MATLAB,然后在MA TLAB主界面中单击上面的Simulink按钮或在命令窗口中输入simulink命令。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
SIMULINK的模块库介绍SIMILINK模块库按功能进行分类,包括以下8类子库:
Continuous(连续模块)
Discrete(离散模块)
Function&Tables(函数和平台模块)
Math(数学模块)
Nonlinear(非线性模块)
Signals&Systems(信号和系统模块)
Sinks(接收器模块)
Sources(输入源模块)
1、连续模块(Continuous)continuous.mdl
Integrator:输入信号积分
Derivative:输入信号微分
State-Space:线性状态空间系统模型
Transfer-Fcn:线性传递函数模型
Zero-Pole:以零极点表示的传递函数模型
Memory:存储上一时刻的状态值
Transport Delay:输入信号延时一个固定时间再输出
Variable Transport Delay:输入信号延时一个可变时间再输出
2、离散模块(Discrete) discrete.mdl
Discrete-time Integrator:离散时间积分器
Discrete Filter:IIR与FIR滤波器
Discrete State-Space:离散状态空间系统模型
Discrete Transfer-Fcn:离散传递函数模型
Discrete Zero-Pole:以零极点表示的离散传递函数模型
First-Order Hold:一阶采样和保持器
Zero-Order Hold:零阶采样和保持器
Unit Delay:一个采样周期的延时
3、 Function&Tables(函数和平台模块)function.mdl
Fcn:用自定义的函数(表达式)进行运算
MATLAB Fcn:利用matlab的现有函数进行运算
S-Function:调用自编的S函数的程序进行运算
Look-Up Table:建立输入信号的查询表(线性峰值匹配)
Look-Up Table(2-D):建立两个输入信号的查询表(线性峰值匹配)
4、 Math(数学模块)math.mdl
Sum:加减运算
Product:乘运算
Dot Product:点乘运算
Gain:比例运算
Math Function:包括指数函数、对数函数、求平方、开根号等常用数学函数
Trigonometric Function:三角函数,包括正弦、余弦、正切等
MinMax:最值运算
Abs:取绝对值
Sign:符号函数
Logical Operator:逻辑运算
Relational Operator:关系运算
Complex to Magnitude-Angle:由复数输入转为幅值和相角输出
Magnitude-Angle to Complex:由幅值和相角输入合成复数输出
Complex to Real-Imag:由复数输入转为实部和虚部输出
Real-Imag to Complex:由实部和虚部输入合成复数输出
5、 Nonlinear(非线性模块) nonlinear.mdl
Saturation:饱和输出,让输出超过某一值时能够饱和。
Relay:滞环比较器,限制输出值在某一范围内变化。
Switch:开关选择,当第二个输入端大于临界值时,输出由第一个输入端而来,否则输出由
第三个输入端而来。
Manual Switch:手动选择开关
6、Signal&Systems(信号和系统模块) sigsys.mdl
In1:输入端。
Out1:输出端。
Mux:将多个单一输入转化为一个复合输出。
Demux:将一个复合输入转化为多个单一输出。
Ground:连接到没有连接到的输入端。
Terminator:连接到没有连接到的输出端。
SubSystem:建立新的封装(Mask)功能模块
7、Sinks(接收器模块) sinks.mdl
Scope:示波器。
XY Graph:显示二维图形。
To Workspace:将输出写入MATLAB的工作空间。
To File(.mat):将输出写入数据文件。
8、Sources(输入源模块) sources.mdl
Constant:常数信号。
Clock:时钟信号。
From Workspace:来自MATLAB的工作空间。
From File(.mat):来自数据文件。
Pulse Generator:脉冲发生器。
Repeating Sequence:重复信号。
Signal Generator:信号发生器,可以产生正弦、方波、锯齿波及随意波。
Sine Wave:正弦波信号。
Step:阶跃波信号