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!