枫叶ss 2021-06-08 16:59 采纳率: 100%
浏览 27
已采纳

matlab完整程序,急!大佬帮帮孩子吧

 

  • 写回答

2条回答 默认 最新

  • MilkshakeのMilktea 2021-06-08 19:36
    关注
    clear; clc;
    % (1)
    Gs = 1.5 * feedback( ...
        tf([1, 0.5], [1, 0.1]) * ...
        tf(20, [1, 12, 20, 0]), -1)
    % (2)
    [zero_point, pole_point, gain] = ...
        tf2zp(Gs.Numerator{1}, Gs.Denominator{1});
    stability = true;
    zp = [zero_point; pole_point];
    for tmp = 1:length(zp)
        if (zp(tmp) >= 0)
            stability = false;
        end
    end
    if (stability)
        disp("稳定");
    else 
        disp("不稳定");
    end
    clear stability zp tmp;
    % (3)
    rlocus(Gs)
    locus = rlocus(Gs);
    [m, n] = size(locus);
    for mi = 1:m
        for ni = 1:n
            if (abs(real(locus(mi, ni))) < 0.06)
                % 筛选可能的点,看根轨迹图能找到和虚轴的交点
                disp(locus(mi, ni));
            end
        end
    end
    clear m mi n ni locus;
    % (4)
    fig = figure("Name", "responese");
    subplot(2, 2, 1); hold on;
    impulse(tf(1, 1), 1.5);
    impulse(tf([1, 0], 1)*Gs, 1.5);
    title("impulse response");
    legend("input", "output"); grid on;
    subplot(2, 2, 2); hold on;
    step(tf(1, 1), 1.5)
    step(Gs, 1.5);
    title("step response");
    legend("input", "output"); grid on;
    subplot(2, 2, 3); hold on;
    step(tf(1, [1, 0]), 1.5)
    step(tf(1, [1, 0])*Gs, 1.5);
    title("step response");
    legend("input", "output"); grid on;
    

    最后一个脉冲、阶跃、斜坡只有三个啊?第四个也不知道画啥。望采纳。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?