首页 文章

在循环中更改传递函数 - simulink

提问于
浏览
0

我开始使用Simulink,我有一个关于使用matlab for循环来改变传递函数的问题 .

假设我有以下问题:
enter image description here

我的目标是“系统”将等于:

enter image description here

基本上我想在5个不同的传递函数中从时间= 0到时间= 10运行5次Simulink仿真 .

任何帮助表示赞赏 . 谢谢 .

1 回答

  • 0

    除非我误解了你的问题,否则我不会尝试这样做,它可以在普通的MATLAB中完成(使用control system toolbox):

    t = 0:1e-3:10;
    u = ones(size(t));
    y = zeros(5,length(t));
    for k=1:5
        H = (1 + tf('s')*5/k)^k; % system transfer function
        CL = 1/((tf('s'))^2*(1-H)); % closed-loop transfer function
        y(k,:) = (lsim(CL,u,t))';
    end
    plot(t,y)
    legend('#1','#2','#3','#4','#5','Location','NorthWest')
    grid on
    xlabel('Time [s]')
    ylabel('Output')
    

    产生以下图(在Octave中) . 只有前2次迭代才会给出非零输出:

    enter image description here

相关问题