Why can't a variable holding an equation be used to make a function handle?
1 次查看(过去 30 天)
显示 更早的评论
%% Test
syms x
eqn(x) = x^2
func = @(x) eqn
func(2)
采纳的回答
madhan ravi
2020-2-20
I would simply use matlabFunction() as sir Walter says but maybe you have the follwing in mind:
func = @(x) eqn(x)
更多回答(1 个)
Walter Roberson
2020-2-20
Use matlabFunction()
2 个评论
Walter Roberson
2020-2-20
Suppose you were to do
A=1; B=2;
C=A+B;
D = @(A) C
What value would you expect D(0) to have? What value would you expect D(5) to have?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!