I don't untersantd the following error:

??? Input argument "a" is undefined.
Error in ==> primeira at 3
f =(-3-a-b)^2 + ( -1.89-a-b*exp(0.5*c) )^2 + (-1.03 - a- b*exp(c))^2 + (-0.36-a-b*exp(1.5*c))^2 + (0.16-a-b*exp(2*c))^2 + (0.57-a-b*exp(2.5*c))^2 +
(0.88-a-b*exp(3*c))^2 ;
My function is:
function [F ] =primeira (a,b,c)
f =(-3-a-b)^2 + ( -1.89-a-b*exp(0.5*c) )^2 + (-1.03 - a- b*exp(c))^2 + (-0.36-a-b*exp(1.5*c))^2 + (0.16-a-b*exp(2*c))^2 + (0.57-a-b*exp(2.5*c))^2 + (0.88-a-b*exp(3*c))^2 ;
F= [diff(f,a) ; diff(f,b) ; diff(f,c) ];
end

댓글 수: 1

Star Strider
Star Strider 2015년 12월 19일
What code did you use to call your function?

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2015년 12월 19일

1 개 추천

syms a b c
f =(-3-a-b)^2 + ( -1.89-a-b*exp(0.5*c) )^2 + (-1.03 - a- b*exp(c))^2 ...
+ (-0.36-a-b*exp(1.5*c))^2 + (0.16-a-b*exp(2*c))^2 + (0.57-a-b*exp(2.5*c))^2 + (0.88-a-b*exp(3*c))^2 ;
df = jacobian(f,[a,b,c])
dfun = matlabFunction(df)

이 질문은 마감되었습니다.

질문:

2015년 12월 19일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by