视频链接:
首先建立如下Simulink模型:
视频中的脚本如下:
mdlName = 'zeroes_2ndorder';
figure('name','二阶系统增加零点后的影响','units','normalized','outerposition',[0 0 1 1]);
grid on;
legend_index=1;
hold on;
for a = [3,5,10,-3]
disp(['Running Test Cycle with a =',num2str(a)]);
load_system(mdlName);
cs = getActiveConfigSet(mdlName);
model_cs = cs.copy;
set_param(model_cs,'MaxStep','0.01');
simOut = sim(mdlName,model_cs);
hplot(legend_index)=plot(simOut.logsout{1}.Values);
hold on;
legendInfo{legend_index}=(['a=',num2str(a)]); % or whatever is appropriate
legend(hplot(1:legend_index), legendInfo(1:legend_index));
drawnow();
legend_index=legend_index+1;
end
hplot(legend_index)=plot(simOut.logsout{2}.Values);
hold on;
legendInfo{legend_index}=('no zero 2nd order system'); % or whatever is appropriate
legend(hplot(1:legend_index), legendInfo(1:legend_index));
drawnow();
title('Effect of adding a zero to a two-pole system');
xlabel('Time(seconds)','FontAngle','italic');
ylabel('Normalized c(t)','FontAngle','italic');