Click here to load reader

Simulink 入门

  • Upload
    cana

  • View
    331

  • Download
    4

Embed Size (px)

DESCRIPTION

Simulink 入门 . 什么是 Simulink Simulink 是 MATLAB 提供的实现动态系统建模和仿真的一个软件包 . 它让用户把精力从编程转向模型的构造 . Simulink 一个很大的优点是为用户省去了许多重复的代码编写工作 , . Simulink 的启动 . 首先须确定 MATLAB 已安装了 Simulink 工具箱 . 在工具栏点击 Simulink 图标 : 或在 Command Window 中输入 >> Simulink 即出现 Simulink Library Browser 窗口 : . Simulink 图标. - PowerPoint PPT Presentation

Citation preview

  • Simulink SimulinkSimulinkMATLAB. .Simulink,

  • Simulink MATLABSimulink. Simulink:

    Command Window>> SimulinkSimulink Library Browser:

    Simulink

  • Simulink, Continuous, Discrete,, Sinks, Sources.Sources(), Clock(t), Constant(), Sine Wave(), Step().Sinks(), Display(), Scope(), XY Graph(), To File(), To Workspace(Workspace), Stop Simulation().

  • ContinuousDiscrete, Derivative(), Integrator(), State-Space(), Transfer Fcn(), Discrete Transfer Fcn(), Discrete Filter(), Discrete State-Space().Simulink Library Browser, (new model), , , ().

  • 1 (1) ; (Sine Wave) , .Sine WavePhase()pi/2, cos t; Sine Wave1Phase0.

  • (2) ; (Sine WaveIntegrator)Sine WavePhase()pi/2, cos t; IntegratorInitial condition()0.XY Graph, x1.5~1.5, y1.2~1.2.

  • (3) (State-Space)State-Space, A=[0,1;1,0], B=[0;0], C=[1,0;0,1], D=[0;0]. Initial conditions[1;0].XY Graph, x1.5~1.5, y1.2~1.2. Scopey, Axes Propeties.

  • 2 -:(, )x(t), (, )y(t),

    r = 1, d = 0.5, a = 0.1, b = 0.02, x(0) = 25, y(0) = 2. x(t), y(t)y(x).

  • 1 mshier.m:function xdot=shier(t,x)r=1; d=0.5; a=0.1; b=0.02;xdot=diag([r-a*x(2), -d+b*x(1)])*x; Command Window:ts=0:0.1:15; x0=[25,2];[t,x]=ode45('shier',ts,x0);[t,x]plot(t,x), grid, gtext('x1(t)'), gtext('x2(t)'), pause,plot(x(:,1),x(:,2)), grid, xlabel('x1'), ylabel('x2')

  • 2 Simulink

  • S- (User-Defined Functios), S-. S-. S-mshier_s.m, S-Function, S-Function"shier_s"(m). mMATLAB. S-sfuntmp1.m, . (, S-.)

  • XY GraphScope

  • : , ,

    x, y, , r1, r2, n1, n2. s1, s2, .

    x(t), y(t), .

  • 3 (help/demos/simulink):

  • v(t), h(t).