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

How to plot non-linear state space models in Simulink?

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

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

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

我没有找到关于如何在 MathWorks 上绘制非线性状态 space 模型表示的参考资料。

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

那么,我如何在 Simulink 中绘制非线性状态 space 模型的响应? 如有任何建议,我们将不胜感激。

您可以使用 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.';