CLC,关闭,清晰;
file1 = fopen('set9_1.txt');
set9_1 = fscanf(file1,'%F',200);
dt = 1;
t = 1:dt:200;
step_resp = set9_1;
Imm_Resp = [diff(step_rep)./ dt;0];
fs = 1 / dt;
freq = logspace(-3,log10(fs / 3),100);
b = inm_rep';
a = [1 zeros(1,长度(Imp_rep)-1)];
[g,p] = dbode(b,a,dt,2 * pi * freq);
p = p-p(1);
static_gain = g(1);
fc = Interp1(p,freq,-90);
wc = 2 * pi * fc;
mod_at_fc = Interp1(freq,g,fc);
q = mod_at_fc /(static_gain);
num = [0 0 static_gain];
DEN = [1 / WC ^ 2 1 /(WC * Q)1];
[g_id,p_id] = bode(num,den,2 * pi * freq);
图(2),
子图(2,1,1),loglog(freq,g,'B',freq,g_id,'r');网格
标题('sys tf');
ylabel('震级')
传奇('措施'那'模型')
子图(2,1,2),semilogx(freq,p,'B',freq,p_id,'r');网格
ylabel('相位(°)')
Xlabel('频率(Hz)')
传奇('措施'那'模型')
轴([min(freq)max(freq)-360 0]);
sr_id =步骤(num,den,t);
图(3),
绘图(t,step_resp,'B',t,sr_id,'r');网格
标题('sys步骤响应');
传奇('措施'那'模型')