Prev: ezplot & color
Next: basics
From: xety89 on 22 Apr 2010 03:45 Hi, I have this graph: x = [0.000235 0.00025 0.0003 0.0004 0.0005 0.0006 0.00075] y = [54.9 43.1 62.7 86.3 86.3 90.2 96.1] plot (x, y) xlabel ('Amplitude') ylabel ('Correct Detection [%]') legend ('Psychometric Function') and I want to fit it to this equation: P(A, 'theta') = [1/sqrt(2*pi*sigma²)] * integral e^-[(A-'theta'²)/2*sigma²] how can i do this? thank you.
From: John D'Errico on 22 Apr 2010 05:21 "xety89 " <sow.chan(a)warwick.ac.uk> wrote in message <hqouqh$snf$1(a)fred.mathworks.com>... > Hi, > > I have this graph: > > x = [0.000235 0.00025 0.0003 0.0004 0.0005 0.0006 0.00075] > y = [54.9 43.1 62.7 86.3 86.3 90.2 96.1] > > plot (x, y) > xlabel ('Amplitude') > ylabel ('Correct Detection [%]') > legend ('Psychometric Function') > > and I want to fit it to this equation: > > P(A, 'theta') = [1/sqrt(2*pi*sigma²)] * integral e^-[(A-'theta'²)/2*sigma²] > > how can i do this? Hmm. I have a funny feeling that your expression is wrong. Everything about that expression is a simple, cumulative normal, except for that you square theta, as opposed to squaring the difference (A-theta). Beyond that, your expression is not meaningful in terms of the data that you have. You are talking about doing some sort of a nonlinear least squares fit to that expression, but that expression cannot yield any numbers that are even reasonably close to the data that you pose. My guess is that you wish to scale and shift this curve, using that general shape to model your data. Note that a nice way to obtain this cumulative normal shape (if you don't have the stats toolbox) is to use erf. If you do have the stats TB, then call normcdf. NEVER do the integration yourself using quad. John
|
Pages: 1 Prev: ezplot & color Next: basics |