From: Matthew on
Dear All,

I would appreciate someones help on this...

I am trying to find a Sine fit to some descrete data points that I have (data is at the end of this). I would like to able to fit a Sine in the form of Y = A + BSin(C + D) where A B and D are constants, C will be an angle. Once i have a fit, I can then compare this with my data for each angle.

The data below, first set are my 'Y' values and second set (O:6:354) are my angles.

Oh and i dont have any other toolboxes such as curve fitting (shame!) so i need to do this somehow without.

Mnay thanks in anticipation,
Matt


127.5161 127.52 127.56 127.5 127.3 127.7273 127.7917 127.4783 127.6667 127.5 127.7727 127.625 128 127.7692 127.9524 128.2174 128.15 128.2632 128.3913 128.7222 128.7143 128.9524 128.95 129.1053 129.0435 129.1579 129.3684 129.5417 129.2857 129.5294 129.2727 129.6471 129.3 129.4706 129.5238 129.5926 129.4737 129.5294 129.65 129.4 129.4706 129.0909 129.08 129.05 128.9565 128.8182 128.7222 128.5455 128.4737 128.5455 128.15 128.16 128.3333 127.8636 128 128.1304 127.6842 127.8571 127.8846 127.6
0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 126 132 138 144 150 156 162 168 174 180 186 192 198 204 210 216 222 228 234 240 246 252 258 264 270 276 282 288 294 300 306 312 318 324 330 336 342 348 354
From: Matt J on
"Matthew " <matthew_talboys(a)hotmail.com> wrote in message <i3roeg$94m$1(a)fred.mathworks.com>...
> Dear All,
>
> I would appreciate someones help on this...
>
> I am trying to find a Sine fit to some descrete data points that I have (data is at the end of this). I would like to able to fit a Sine in the form of Y = A + BSin(C + D) where A B and D are constants, C will be an angle. Once i have a fit, I can then compare this with my data for each angle.
====================

Your unknowns A,B,D are magnitudes and phases of sinusoidal components. It is the kind of thing that Fourier analysis gives you.

help fft
From: Greg Heath on
On Aug 10, 10:41 am, "Matthew " <matthew_talb...(a)hotmail.com> wrote:
> Dear All,
>
> I would appreciate someones help on this...
>
> I am trying to find a Sine fit to some descrete data points that I have (data is at the end of this). I would like to able to fit a Sine in the form of Y = A + BSin(C + D) where A B and D are constants, C will be an angle.. Once i have a fit, I can then compare this with my data for each angle.

Use a different form that is linear in the unknown
constants A0,A1 and B1.

Y = A0 + A1*cos(C) + B1*sin(C)

> The data below, first set are my 'Y' values and second set (O:6:354) are my angles.

You then have 60 equations for 3 unknowns:

Piece of cake.

Hope this helps.

Greg
From: Matthew on
Greg Heath <heath(a)alumni.brown.edu> wrote in message <56a56b5a-6a07-4e6c-b611-43693529e6c8(a)q22g2000yqm.googlegroups.com>...
> On Aug 10, 10:41 am, "Matthew " <matthew_talb...(a)hotmail.com> wrote:
> > Dear All,
> >
> > I would appreciate someones help on this...
> >
> > I am trying to find a Sine fit to some descrete data points that I have (data is at the end of this). I would like to able to fit a Sine in the form of Y = A + BSin(C + D) where A B and D are constants, C will be an angle. Once i have a fit, I can then compare this with my data for each angle.
>
> Use a different form that is linear in the unknown
> constants A0,A1 and B1.
>
> Y = A0 + A1*cos(C) + B1*sin(C)
>
> > The data below, first set are my 'Y' values and second set (O:6:354) are my angles.
>
> You then have 60 equations for 3 unknowns:
>
> Piece of cake.
>
> Hope this helps.
>
> Greg

Dear Both,

Many thanks for your replies. The equation i need to fit to needs to be in the form
Y = A + BSin(C + D) rather than a combination of sine and cosine terms.

Could either of you elaborate on a worked examples how i could do this, i'm sure it is a piece of cake, but I am not too mathematically minded!

Many thanks,
matt
From: Ross W on
"Matthew " <matthew_talboys(a)hotmail.com> wrote in message <i3tmv7$7e0$1(a)fred.mathworks.com>...
> Greg Heath <heath(a)alumni.brown.edu> wrote in message <56a56b5a-6a07-4e6c-b611-43693529e6c8(a)q22g2000yqm.googlegroups.com>...
> > On Aug 10, 10:41 am, "Matthew " <matthew_talb...(a)hotmail.com> wrote:
> > > Dear All,
> > >
> > > I would appreciate someones help on this...
> > >
> > > I am trying to find a Sine fit to some descrete data points that I have (data is at the end of this). I would like to able to fit a Sine in the form of Y = A + BSin(C + D) where A B and D are constants, C will be an angle. Once i have a fit, I can then compare this with my data for each angle.
> >
> > Use a different form that is linear in the unknown
> > constants A0,A1 and B1.
> >
> > Y = A0 + A1*cos(C) + B1*sin(C)
> >
> > > The data below, first set are my 'Y' values and second set (O:6:354) are my angles.
> >
> > You then have 60 equations for 3 unknowns:
> >
> > Piece of cake.
> >
> > Hope this helps.
> >
> > Greg
>
> Dear Both,
>
> Many thanks for your replies. The equation i need to fit to needs to be in the form
> Y = A + BSin(C + D) rather than a combination of sine and cosine terms.
>
> Could either of you elaborate on a worked examples how i could do this, i'm sure it is a piece of cake, but I am not too mathematically minded!
>
> Many thanks,
> matt

hi

I suggest you follow the advice, and then use this identity to convert to the form you want:

sin(C+D) = sin(C) cos(D) + cos(C) sin(D)
look on wikipedia for trig identities if you want to see more

ross

ross