jennychung 发表于 2007-4-1 20:29

求助,出错了?

figure('pos',,'color','w');
axes('pos',);
syms s t
T=2;K=1;
T1=sym(num2str(T));K1=sym(num2str(K));
m0=2;e0=2;gs=m0/e0;rt=2;et1=rt;
for tt=0:0.05:20;
    if et1>e0,eout=m0;
    elseif et1<-e0,eout=-m0;
    else eout=gs*et;
    end
    ee=sym(num2str(eout));
    y1=ilaplace(K1*ee/s/(T1*s^2+s+1));
    et=rt-y1;det=diff(et);
    et1=subs(et,tt);det1=subs(det,tt);
    plot(et1,det1);hold on;
end
grid

??? Function 'max' is not defined for values of class 'sym'.

Error in ==> num2str at 70
        xmax = double(max(abs(x(:))));

是什么错误呢?

eight 发表于 2007-4-1 20:38

原帖由 jennychung 于 2007-4-1 20:29 发表
figure('pos',,'color','w');
axes('pos',);
syms s t
T=2;K=1;
T1=sym(num2str(T));K1=sym(num2str(K));
m0=2;e0=2;gs=m0/e0;rt=2;et1=rt;
for tt=0:0.05:20;
    if et1>e0,eout=m0;
    elseif e ...


max 函数不支持符号变量,建议先阅读matlab基础书,而不是一遇到问题就发问
页: [1]
查看完整版本: 求助,出错了?