syms a y t;
z0=diff(sym('y(t)'))+a*sym('y(t)');
z=laplace(z0);
F1=subs(z,'laplace(y(t),t,s)',sym('Y'));
F2=subs(F1,'y(0)',sym('1'));
Y=solve(F2,sym('Y'));
y=ilaplace(Y);
第二行 z0=diff(sym('y(t)'))+a*sym('y(t)');
其中的y(t)难道不是另一个新的符号变量吗。
工作空间中没有出现这个y(t)
第二点,为何每次都要用sym定义y(t)-------sym('y(t)')

 Réponse acceptée

gejalot
gejalot le 20 Nov 2022

0 votes

就是因为没有直接定义过y(t)所以才需要每次用sym,如果写法是:
syms t y(t)
那么后续可以直接使用:
z0=diff(y)+a*y;
注意这里的y的类型是symfun,而不是sym
另外,版本太老的话是不支持这种用法的

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!