Thread Subject: fitting script

Subject: fitting script

From: yakir

Date: 30 Dec, 2008 21:07:02

Message: 1 of 3

I am trying to make a simple fit and I just don't get things right.

I am trying to fit for the function y=a*sin(b*x+c)
I have the variable
y=[1,1.1............]
and
x=[0,0.2,..............]

those hold the information to fit by

if can someone write the script that will give me a, b and c properly
it will be very helpful
thanks

Subject: fitting script

From: Mastaneh

Date: 30 Dec, 2008 21:21:02

Message: 2 of 3

yakir <yakirsudry@gmail.com> wrote in message <4bc2addb-8190-420f-b4e1-d4c084d8caab@l33g2000pri.googlegroups.com>...
> I am trying to make a simple fit and I just don't get things right.
>
> I am trying to fit for the function y=a*sin(b*x+c)
> I have the variable
> y=[1,1.1............]
> and
> x=[0,0.2,..............]
>
> those hold the information to fit by
>
> if can someone write the script that will give me a, b and c properly
> it will be very helpful
> thanks

I would suggest using the curve fitting Toolbox. Just type 'cftool' in the command line, import your x and y data, and select the type of fit you're looking for - in this case, Sum of Sin Functions. Once satisfied with the fit, you can generate an M-file from the File menu and modify it if you wish.

hope it helps,
Mastaneh

Subject: fitting script

From: someone

Date: 30 Dec, 2008 21:56:01

Message: 3 of 3

"Mastaneh" <mtorkama@iupui.edu> wrote in message <gje3bu$l24$1@fred.mathworks.com>...
> yakir <yakirsudry@gmail.com> wrote in message <4bc2addb-8190-420f-b4e1-d4c084d8caab@l33g2000pri.googlegroups.com>...
> > I am trying to make a simple fit and I just don't get things right.
> >
> > I am trying to fit for the function y=a*sin(b*x+c)
> > I have the variable
> > y=[1,1.1............]
> > and
> > x=[0,0.2,..............]
> >
> > those hold the information to fit by
> >
> > if can someone write the script that will give me a, b and c properly
> > it will be very helpful
> > thanks
>
> I would suggest using the curve fitting Toolbox. Just type 'cftool' in the command line, import your x and y data, and select the type of fit you're looking for - in this case, Sum of Sin Functions. Once satisfied with the fit, you can generate an M-file from the File menu and modify it if you wish.
>
> hope it helps,
> Mastaneh

If you don't have the curve fitting toolbox, you can try EzyFit from the file exchange.

http://www.mathworks.com/matlabcentral/fileexchange/10176

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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com