Matlab中subs函数的使用syms x w b t;x=dsolve('D2x+2*b*Dx+w^2*x=0','Dx(0)=4,x(0)=0');dx=diff(x,t);w=2;b=0.1;x1=subs(x);dx1=subs(dx);t=0:0.1:100;xt=subs(x1,t);dxt=subs(dx1,t);subplot(221);plot(t,xt);subplot(222); subplot(222);plot(xt,dxt)其中四
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 09:55:42
Matlab中subs函数的使用syms x w b t;x=dsolve('D2x+2*b*Dx+w^2*x=0','Dx(0)=4,x(0)=0');dx=diff(x,t);w=2;b=0.1;x1=subs(x);dx1=subs(dx);t=0:0.1:100;xt=subs(x1,t);dxt=subs(dx1,t);subplot(221);plot(t,xt);subplot(222); subplot(222);plot(xt,dxt)其中四
Matlab中subs函数的使用
syms x w b t;
x=dsolve('D2x+2*b*Dx+w^2*x=0','Dx(0)=4,x(0)=0');
dx=diff(x,t);
w=2;
b=0.1;
x1=subs(x);
dx1=subs(dx);
t=0:0.1:100;
xt=subs(x1,t);
dxt=subs(dx1,t);
subplot(221);
plot(t,xt);
subplot(222);
subplot(222);
plot(xt,dxt)
其中四次用到subs函数,
Matlab中subs函数的使用syms x w b t;x=dsolve('D2x+2*b*Dx+w^2*x=0','Dx(0)=4,x(0)=0');dx=diff(x,t);w=2;b=0.1;x1=subs(x);dx1=subs(dx);t=0:0.1:100;xt=subs(x1,t);dxt=subs(dx1,t);subplot(221);plot(t,xt);subplot(222); subplot(222);plot(xt,dxt)其中四
R = subs(S) replaces all occurrences of variables in the symbolic expression S with values obtained from the calling function, or the MATLAB workspace.
相当于于用值去替换符号表达式中的变量
例如:
The statement
y = dsolve('Dy = -a*y')
produces
y =
C2/exp(a*t)
Then the statements
a = 980; C2 = 3; subs(y)
produce
ans =
3/exp(980*t)