matlab 给表达式中的变量赋值

syms x ty=x+t现在我想令z=y(2)=2+t 怎么做?
2025-03-11 02:39:42
推荐回答(1个)
回答1:

使用subs函数。

参考代码:

>> syms x t
>> y=x+t 
y = 
x+t 
 
>> z=subs(y,x,2) 
z = 
2+t