Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: fitting script
Date: Tue, 30 Dec 2008 21:56:01 +0000 (UTC)
Organization: Mitre Corp
Lines: 26
Message-ID: <gje5dh$k8h$1@fred.mathworks.com>
References: <4bc2addb-8190-420f-b4e1-d4c084d8caab@l33g2000pri.googlegroups.com> <gje3bu$l24$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230674161 20753 172.30.248.35 (30 Dec 2008 21:56:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Dec 2008 21:56:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:509272


"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