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 Comment

What code did you use to call your function?

Answers (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)

This question is closed.

Asked:

on 19 Dec 2015

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!