你会受到良心的谴责:急询:Matlab中 subs(S)的应用疑问?

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 21:48:17
1.subs(S)到底是什么函数?其什么作用,谢谢!
2.下段绘图程序如下的话就画出不来:
syms x t;
t=0:pi/60:2*pi;
y1=sin(x);
y2=cos(x);
plot(y1,y2)
而把 plot(y1,y2) 改成 plot(subs(y1),subs(y2)) 就可以运行成功画出来了。
为什么?subs 在此起到什么作用?
而不加 subs 为什么运行不了?
急,多谢!

SUBS(S) replaces all the variables in the symbolic expression S with
values obtained from the calling function, or the MATLAB workspace.
subs(S)表示:用数值替代所有的符号变量。
y1=int(sin(x),x,0,t); 的结果是y1=-cos(t)+1,是符号结果,用subs(y1),将y1中的所有符号变为数值。

clc;clear
symst;
t=0:pi/60:2*pi;
y1=sin(t);
y2=cos(t);
plot(subs(y1),subs(y2))

SUBS(S) replaces all the variables in the symbolic expression S with
values obtained from the calling function, or the MATLAB workspace.
意思是将符号变量变成值,从调用函数或者matlab空间获得。
这种问题可以用help subs命令来察看。
如果你不要syms x t;也可以成功,不知道你为什么要把他们当成符号处理.