解答:
x1=[0:20];y1=[0:20];
df2=subs(df1,{x,y},{x1,y1})
总结:
利用命令 help subs,查看subs的作用.
Matlab中的实例为:
实例1: Single input:
Suppose a = 980 and C1 = 3 exist in the workspace.
The statement
y = dsolve('Dy = -a*y')
produces
y = exp(-a*t)*C1
Then the statement
subs(y)
produces
ans = 3*exp(-980*t)
实例2: Single Substitution:
subs(a+b,a,4) returns
4+b.
实例3: Multiple Substitutions:
subs(cos(a)+sin(b),{a,b},{sym('alpha'),2}) returns
cos(alpha)+sin(2)
实例4: Scalar Expansion Case:
subs(exp(a*t),'a',-magic(2)) returns
[ exp(-t), exp(-3*t)]
[ exp(-4*t), exp(-2*t)]
实例5: Multiple Scalar Expansion:
subs(x*y,{x,y},{[0 1;-1 0],[1 -1;-2 1]}) returns
[ 0, -1]
[ 2, 0]
可参考subexpr