Path: news.mathworks.com!not-for-mail
From: "Mastaneh" <mtorkama@iupui.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: fitting script
Date: Tue, 30 Dec 2008 21:21:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <gje3bu$l24$1@fred.mathworks.com>
References: <4bc2addb-8190-420f-b4e1-d4c084d8caab@l33g2000pri.googlegroups.com>
Reply-To: "Mastaneh" <mtorkama@iupui.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230672062 21572 172.30.248.37 (30 Dec 2008 21:21:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Dec 2008 21:21:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 648205
Xref: news.mathworks.com comp.soft-sys.matlab:509268


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