Thread Subject: CURVE FITTING LEGENDS

Subject: CURVE FITTING LEGENDS

From: Andres Klever

Date: 21 Oct, 2009 20:34:04

Message: 1 of 5

Hi, my problem is that when i plot the fit for my curve, in the legend just appear "curve fitting", and i want it that shows the rsquare and the equation, how can i do this???

thanks!

Subject: CURVE FITTING LEGENDS

From: the cyclist

Date: 21 Oct, 2009 20:40:24

Message: 2 of 5

"Andres Klever" <andisoto@gmail.com> wrote in message <hbnr7s$39c$1@fred.mathworks.com>...
> Hi, my problem is that when i plot the fit for my curve, in the legend just appear "curve fitting", and i want it that shows the rsquare and the equation, how can i do this???
>
> thanks!

Not 100% sure what you are asking for, but if you literally mean the "legend" command, then you can create any string you want to be displayed. You might need to use the "num2str" command to convert any dynamic quantity to a string to be displayed.

Hope that helps

the cyclist

Subject: CURVE FITTING LEGENDS

From: Andres Klever

Date: 21 Oct, 2009 23:03:00

Message: 3 of 5

"the cyclist" <thecyclist@gmail.com> wrote in message <hbnrjo$rcl$1@fred.mathworks.com>...
> "Andres Klever" <andisoto@gmail.com> wrote in message <hbnr7s$39c$1@fred.mathworks.com>...
> > Hi, my problem is that when i plot the fit for my curve, in the legend just appear "curve fitting", and i want it that shows the rsquare and the equation, how can i do this???
> >
> > thanks!
>
> Not 100% sure what you are asking for, but if you literally mean the "legend" command, then you can create any string you want to be displayed. You might need to use the "num2str" command to convert any dynamic quantity to a string to be displayed.
>
> Hope that helps
>
> the cyclist


what i am trying to do is something automatic, when i do the fit, that fit has an equation asociated, what i need to do is that the legend shows automatically instead of "curve fitting", the equation, and then shows the Rsquare too.....
if this help, it probably has a lot to do with the 'DisplayName' command



thanks!

 

Subject: CURVE FITTING LEGENDS

From: Frederic Moisy

Date: 22 Oct, 2009 11:04:04

Message: 4 of 5

Hi
You can have a look to the Ezyfit toolbox:
http://www.mathworks.com/matlabcentral/fileexchange/10176
By default, it displays the equation in a box.
If you want the equation to appear in the legend, use the option "dispfitlegend on"
(see the Settings page in the help)
Frederic



"Andres Klever" <andisoto@gmail.com> wrote in message <hbnr7s$39c$1@fred.mathworks.com>...
> Hi, my problem is that when i plot the fit for my curve, in the legend just appear "curve fitting", and i want it that shows the rsquare and the equation, how can i do this???
>
> thanks!

Subject: CURVE FITTING LEGENDS

From: Andres Klever

Date: 22 Oct, 2009 16:50:09

Message: 5 of 5

"Frederic Moisy" <moisy@fast.u-psud.fr> wrote in message <hbpe74$35m$1@fred.mathworks.com>...
> Hi
> You can have a look to the Ezyfit toolbox:
> http://www.mathworks.com/matlabcentral/fileexchange/10176
> By default, it displays the equation in a box.
> If you want the equation to appear in the legend, use the option "dispfitlegend on"
> (see the Settings page in the help)
> Frederic
>
>
>
> "Andres Klever" <andisoto@gmail.com> wrote in message <hbnr7s$39c$1@fred.mathworks.com>...
> > Hi, my problem is that when i plot the fit for my curve, in the legend just appear "curve fitting", and i want it that shows the rsquare and the equation, how can i do this???
> >
> > thanks!


thanks a lot frederic, this tool is great, but check this

In order to perform a weighted fit on this data, the vectors y and dy have to be merged into a 2-by-N matrix and given as the second input argument to ezfit. Compare the results for the usual and weighted fits:

fw = ezfit(x, [y;dy], 'exp');
showfit(fw,'fitcolor','red');
f = ezfit(x, y, 'exp');
showfit(f,'fitcolor','blue');

when i DO THIS the problem with matlab is this

??? Error using ==> ezfit at 272
X and Y dimensions must agree.

mmm, what can i do ??

thanks

Tags for this Thread

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.

rssFeed for this Thread

Contact us at files@mathworks.com