引用:
作者: yhcode
我的理解,subs里的old 和 new是这样的:
old 是 syms 定义的变量,而new是old的实例化,你的段程序里:
y是一个实例,不是syms变量,因此,当你用t = sin(t0)*y;的时候,t的syms表示就是:
[2*sin(t0);2*sin(t0);2*sin(t0)]
所以会得到你的那个结果,如果想得到你希望的结果,需要定义y为cell变量:
syms t, y
t0=1/3*pi;
y0=[1;0;0];
S=sin(t)*y;
subs(S,{t,y},{t0,y0})
|
您好,感谢您的来帖。用您的方法编程MATLAB 会出现以下的提示:
“??? Error using ==> sym.subs
Elements of the substitution cell array must be of the same size.”是不是因为size(y)=1 1