Prev: unilateral Z trans
Next: Passing a value to Lsqcurvefit
From: Alex Thompson on 3 Jun 2010 14:20 Hello, I am quite new to matlab and I am trying to troubleshoot my program, without much success. Basically I am trying to use lsqcurvefit to fit a curve to a data set, and each data set will have a constant value named "dip" associated with it. "Dip" is part of the function I am trying to optimize, however it seems that the lsqcurvefit does not recognize it as a already declared value and issues an error saying that it is an undeclared function of variable. I seem to be having a hard time describing this, so here's a portion of my code below. % Inputs, retrieves most from file called “data”; zi=data(:,1); ui=data(:,2); height= data(1,3); dip=0.6745*height; fun = inline('0.23395*(log(zi./p(1)) - ((zi-p(1))./( dip -p(1))).^3./3) + p(2).*sin(pi.*(zi-p(1))./2./( dip - p(1))).^2','p','zi'); p0=[0.1,0.328]; p = lsqcurvefit(fun,p0, zi, ui); I have tried a couple of things, but they haven't been successful, so any help would be appreciated. Thanks, Alex
|
Pages: 1 Prev: unilateral Z trans Next: Passing a value to Lsqcurvefit |