Author Topic: Problem with fminsearch  (Read 454 times)

Offline carlo666

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Problem with fminsearch
« on: December 12, 2011, 10:46:42 PM »
What's wrong with my code?
It would be nice if someone could look at it,thx.


Code: [Select]
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: [Select]
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


Quote
??? 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)

Matlab and SimuLink Development Forum

Problem with fminsearch
« on: December 12, 2011, 10:46:42 PM »