Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这看起来真的很简单。我想定义一个函数:
syms x
f = x^2
我希望能够做到f(4),它会吐出 16 个。我还想避免编写一个新的 m 文件。
f(4)
处理符号变量时,要替换为数值,请使用subs(),即符号替换:
subs()
syms x f = x^2 subs(f,4)
>> f = @(x) x^2; >> f(4) ans = 16