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

Contact us at files@mathworks.com