Scilab2023简单的尝试

因为种种原因,不能使用Matlab,就接触到了Scilab,有一阵子没有使用了,突然发现被达索收购了。

随便抄一段代码:

clear, clc, clf;
wn = 2;
instants = 0:0.05:20;
kexi = [0.1, 0.5, 1.0, 2.0];
for i = 1:length(kexi)
    s = poly(0, 's');
    h = wn^2 / (s^2 + 2*kexi(i)*wn*s+wn^2);
    s1 = syslin('c', h);
    y = csim('step', instants, s1);
    y1(i, 1:length(y)) = y;
    z = csim('imp', instants, s1);
    z1(i, 1:length(z)) = z;
end
clf(0);
scf(i);
show_window();
xsetech([0.0, 0.0, 1.01, 0.51]);
plot("onn", instants', y1')
xtitle("阶跃响应","t","y");xgrid()
legend(["ξ=0.1";"ξ=0.5";"ξ=1";"ξ=2"])
xsetech([0.0, 0.5, 1.0, 0.5]);
plot("onn", instants', z1')
xtitle("脉冲响应","t","y");xgrid()
legend(["ξ=0.1";"ξ=0.5";"ξ=1";"ξ=2"])

  运行后的效果如下:

 

 尝试一下,调整坐标显示的字体大小,新版是可以调整了的。

 

posted @ 2023-03-26 11:06  颜秋哥  阅读(124)  评论(0编辑  收藏  举报