Re: MPCURVEFIT and CURVEFIT questions [message #32893] |
Fri, 15 November 2002 11:55 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Jonathan Greenberg <greenberg@ucdavis.edu> writes:
> I'm restating a previous question, but I do have a new one:
>
> 1) If CURVEFIT or MPCURVEFIT receive an X or Y array containing at least one
> observation containing NaN, what will happen? Will it simply ignore that
> observation, or will it somehow choke on the results?
You need to remove NaN values before fitting. Or, set the values and
their WEIGHTS to zero.
> 2) Is there any way to get CURVEFIT or MPCURVEFIT to run on a 2-d array of
> observations:
>
> X = [9,8,7; 6,5,4; 3,2,1]
> Y = [1,2,3;1,2,3; 1,2,3]
>
> So it will perform 3 regressions, one for each line of data, and return two
> sets of parameters, SIGMA, whatever, or do I have to brute force it by
> for-next looping through the process?
If you really want to perform three regressions simultaneously, you
can make an explicit model function to do it. The MPFIT family of
routines won't do such a thing automatically.
If you are interested in fitting images, then investigate
MPFIT2DFUN.
If you are interested in fitting multiple series simultaneously, say X
and Y simultaneously as a function of time, then again your model must
explicitly do that. That is documented as a FAQ on my web page.
Craig
|
|
|