MATLAB:problem with fminsearch

Status
Not open for further replies.

yannik33

Member level 1
Joined
Oct 18, 2011
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,507
What's wrong with my code?
It would be nice if someone could look at it,thx.


Code:
clc;
clear;
global x y 

file=load('daten.dat');
x=file(:,1);
y=file(:,2);

theta=[1 1];%to optimize
theta=fminsearch('Gue',theta)

Code:
function G=Gue(theta)
global x y 

a=theta(1);
b=theta(2);
ym=@(x)(((a/((b+(a-b).*exp(-a.*x))))));
G=sum((ym-y).^2);


end


Undefined function or method
'minus' for input arguments of type
'function_handle'.
Error in ==> Gue at 8
G=sum((ym-y).^2);
Error in ==> fminsearch at 191
fv,1) = funfcn(x,varargin{:});
Error in ==> Labority5 at 25
theta=fminsearch('Gue',theta)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…