Thread Subject: Curve Fitting Toolbox -> Export Data of my Fit

Subject: Curve Fitting Toolbox -> Export Data of my Fit

From: Cedric

Date: 27 May, 2009 13:57:01

Message: 1 of 5

Hi,

I am using Curve Data Fitting Toolbox.
I'm able to to fit my data.
but now, I want to export the data of the fit. How can I do this ?

I have try Fitting > Save to workspace... > then I choose
Save fot to matlab object named : fittedmoded1
Save goodness of fit to MATLAB struct named : goodness1
Save fit output to MATLAB struct names : output1

After this, In Matalb workspace, I have the 3 files
right click on fittedmoded1 and then Estimated Function, and Matlab plot my fit. it's great.
But I want to explore the data like a matrix (with x and y), is it possible ? beacause I want to do some mathematical operations after like FWHM.

Thanks,

Cedric

Subject: Curve Fitting Toolbox -> Export Data of my Fit

From: Richard Willey

Date: 27 May, 2009 19:27:11

Message: 2 of 5

Hi Cedric

You're definitely on the right track...

fittedmodel1 is what's known as a Fit Object.

There are lots of methods definited for Fit Objects. One of them is the
plot methods which you've already discovered. (You can get a complete list
of methods by entering methods(fittedmodel1) at the command line)

If you prefer to work with your data in a matrix format you can simple enter
the following

yhat = fittedmodel1(x)

This command will tell MATLAB to pass your x vector into the fit object,
use your model to predict appropriate values for y, and
store these values as a new variable named yhat







"Cedric " <cedric.mathieu@ires.in2p3.fr> wrote in message
news:gvjgrd$r1s$1@fred.mathworks.com...
> Hi,
>
> I am using Curve Data Fitting Toolbox.
> I'm able to to fit my data.
> but now, I want to export the data of the fit. How can I do this ?
>
> I have try Fitting > Save to workspace... > then I choose
> Save fot to matlab object named : fittedmoded1
> Save goodness of fit to MATLAB struct named : goodness1
> Save fit output to MATLAB struct names : output1
>
> After this, In Matalb workspace, I have the 3 files
> right click on fittedmoded1 and then Estimated Function, and Matlab plot
> my fit. it's great.
> But I want to explore the data like a matrix (with x and y), is it
> possible ? beacause I want to do some mathematical operations after like
> FWHM.
>
> Thanks,
>
> Cedric

Subject: Curve Fitting Toolbox -> Export Data of my Fit

From: Cedric

Date: 28 May, 2009 12:42:01

Message: 3 of 5

Hi, thanks for your answer.

I have tested methods(fittedmodel1) and I can see the differents methods for Class cfit.
I have tested the line yhat = fittedmodel1(x) for having my fit in a matrix but it doen't work. I have an error Undefined function or variable 'x'
where is the problem ? Must I declare x as matrix before ?

Thanks in advance

Cedric

"Richard Willey" <rwilley@mathworks.com> wrote in message <gvk46g$4en$1@fred.mathworks.com>...
> Hi Cedric
>
> You're definitely on the right track...
>
> fittedmodel1 is what's known as a Fit Object.
>
> There are lots of methods definited for Fit Objects. One of them is the
> plot methods which you've already discovered. (You can get a complete list
> of methods by entering methods(fittedmodel1) at the command line)
>
> If you prefer to work with your data in a matrix format you can simple enter
> the following
>
> yhat = fittedmodel1(x)
>
> This command will tell MATLAB to pass your x vector into the fit object,
> use your model to predict appropriate values for y, and
> store these values as a new variable named yhat
>
>
>
>
>
>
>
> "Cedric " <cedric.mathieu@ires.in2p3.fr> wrote in message
> news:gvjgrd$r1s$1@fred.mathworks.com...
> > Hi,
> >
> > I am using Curve Data Fitting Toolbox.
> > I'm able to to fit my data.
> > but now, I want to export the data of the fit. How can I do this ?
> >
> > I have try Fitting > Save to workspace... > then I choose
> > Save fot to matlab object named : fittedmoded1
> > Save goodness of fit to MATLAB struct named : goodness1
> > Save fit output to MATLAB struct names : output1
> >
> > After this, In Matalb workspace, I have the 3 files
> > right click on fittedmoded1 and then Estimated Function, and Matlab plot
> > my fit. it's great.
> > But I want to explore the data like a matrix (with x and y), is it
> > possible ? beacause I want to do some mathematical operations after like
> > FWHM.
> >
> > Thanks,
> >
> > Cedric
>

Subject: Curve Fitting Toolbox -> Export Data of my Fit

From: Steven Lord

Date: 28 May, 2009 13:15:26

Message: 4 of 5


"Cedric " <cedric.mathieu@ires.in2p3.fr> wrote in message
news:gvm0qp$cpc$1@fred.mathworks.com...
> Hi, thanks for your answer.
>
> I have tested methods(fittedmodel1) and I can see the differents methods
> for Class cfit.
> I have tested the line yhat = fittedmodel1(x) for having my fit in a
> matrix but it doen't work. I have an error Undefined function or variable
> 'x'
> where is the problem ? Must I declare x as matrix before ?

Yes -- x is the vector/matrix/array of data at which you want to evaluate
the fit. So if you wanted to evaluate your fit at every integer between 1
and 10 inclusive:

x = 1:10;
yhat = fittedmodel1(x);

% or simply
yhat = fittedmodel1(1:10);

--
Steve Lord
slord@mathworks.com

Subject: Curve Fitting Toolbox -> Export Data of my Fit

From: Cedric

Date: 28 May, 2009 14:08:01

Message: 5 of 5

it works

Thanks

"Steven Lord" <slord@mathworks.com> wrote in message <gvm2ov$khn$1@fred.mathworks.com>...
>
> "Cedric " <cedric.mathieu@ires.in2p3.fr> wrote in message
> news:gvm0qp$cpc$1@fred.mathworks.com...
> > Hi, thanks for your answer.
> >
> > I have tested methods(fittedmodel1) and I can see the differents methods
> > for Class cfit.
> > I have tested the line yhat = fittedmodel1(x) for having my fit in a
> > matrix but it doen't work. I have an error Undefined function or variable
> > 'x'
> > where is the problem ? Must I declare x as matrix before ?
>
> Yes -- x is the vector/matrix/array of data at which you want to evaluate
> the fit. So if you wanted to evaluate your fit at every integer between 1
> and 10 inclusive:
>
> x = 1:10;
> yhat = fittedmodel1(x);
>
> % or simply
> yhat = fittedmodel1(1:10);
>
> --
> Steve Lord
> slord@mathworks.com
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
curve data fitt... Cedric 27 May, 2009 09:59:05
rssFeed for this Thread

Contact us at files@mathworks.com