Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Curve fitting errors
Replies: 1   Last Post: Dec 12, 2012 9:46 AM

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: Curve fitting errors
Posted: Dec 12, 2012 9:46 AM

"Sarah " <skragt@gmail.com> wrote in message
news:ka87j8\$gll\$1@newscl01ah.mathworks.com...
> I am attempting to fit a large set of data and locate peaks using a
> Gaussian function. I am not familiar with Matlab, and have started writing
> code for it, but I get an error message. "Undefined function 'minus' for
> input arguments of type 'dataset'"
>
>
> x=hcldcl25th1(:,1);
> y=hcldcl25th1(:,2);
> f(1)=2;
> f(2)=4;
> f(3)=2798;
> fittype=(f(1)*exp(((x-f(3)).^2.*(-4*log(2)))./(f(2).^2)));
>
> f(1), f(2), and f(3) are my initial guesses. What do I need to do, or what
> am I doing wrong?

From the error, the data in your MAT-file is stored in a dataset object. The
arithmetic operations (like PLUS, MINUS, etc.) aren't defined for dataset
objects. You will need to extract the data from the dataset object before
you can perform arithmetic on the data. [After all, it wouldn't make sense
to add the patient's name and the patient's age, would it?]

http://www.mathworks.com/help/stats/dataset-array-columns.html

http://www.mathworks.com/help/stats/perform-dataset-calculations.html

--
Steve Lord
slord@mathworks.com