如何在Simulink中绘制非线性状态空间模型?

时间:2018-11-16 12:39:12

标签: matlab simulink

我正在尝试绘制非线性模型,以便将其与线性模型进行比较。

我正在关注本文Nonlinear Model & Controller Design for Magnetic Levitation System,并尝试复制作者获得的结果。特别是我正在尝试绘制:

enter image description here

enter image description here

enter image description here

以上等式可用矢量格式表示如下:

enter image description here

我没有找到有关如何在MathWorks上绘制非线性状态空间模型表示形式的参考。

Simulink state-space block用于实现线性状态空间系统,而不是非线性状态空间系统。

因此,如何在Simulink中绘制非线性状态空间模型的响应?任何建议将不胜感激。

1 个答案:

答案 0 :(得分:2)

您可以使用Matlab Function Block来实现非线性方程。您可以在此块中定义输入和输出。

功能块的主体如下所示:

function [xdot, y] = nonlinearss(x,u)

    % define your constants
    g = 9.81
    % etc...

    % your nonlinear set of equations
    xdot = [x(2); g-C/m*(x(3)/x(1))^2; etc...] + [0;0;1/L]*u;

    y = x.';