Comparing signals / Fourier calculation tia sal22

Discussion in 'MATLAB' started by Rick T, Sep 1, 2010.

  1. Rick T

    Rick T Guest

    Greetings All

    I have some working test code below and I'm trying to do three more
    things
    1) Is their a way to compare the y2 signal to the y signal to get a
    percentage of error/drift?
    2) Is their a way to find out how many values (x=linspace(0,1,50);) I
    would need to limit the error/drift to less than say 1%
    3) An easier way to check and calculate the Fourier expansion of the
    signal so I wouldn't have to export the y2 value out to a file than
    copy and past it back into the matlab code like I need to do now.


    See working code below

    clear all, clc

    format short g %turns off scientific notation
    tic;


    x=linspace(0,1,50);
    t=linspace(0,1,50); %for use in rebuilding fourier expansion sin and
    cos
    wt=2*pi*x;
    deg =0;
    phase=deg*pi/180;
    vertshift=0;
    y1=sin(1*wt+phase)+vertshift+cos(2*wt+phase)+vertshift;

    VERTOFFmain_1=0;
    VERTOFFaad_1=0;
    AMPmain_1=1;
    AMPaaa_1=0;
    FREQmain_1=1*2*pi;
    FREQaab_1=0;
    PHASEmain_1=0;
    PHASEaac_1=0;


    y=y1;
    y=y';

    N = length(y);
    C = fft(y)/N;
    A = real(C);
    B = imag(C)*-1; %I needed to multiply by -1 to get the correct sign

    % Single-Sided (f >= 0)
    An = [A(1); 2*A(2:N/2); A(N/2+1)]; %needed to put the ' to get vaules
    in rows
    Bn = [B(1); 2*B(2:N/2); B(N/2+1)]; %needed to put the ' to get vaules
    in rows

    %summary = [An Bn]

    %%%%------BEGIN-----------------------------------------------%%%%
    %% An/Bn Section part 1 of 2 Cos/Sin Code for matlab

    phaseStr='(PHASEmain_1)'; %phase string used to get phase 1

    fid = fopen('c:\users\temp\documents\matlab\1delexp.txt', 'w');
    fprintf(fid,' y2= %12.8f+VERTOFFmain_1+VERTOFFaad_1 ...\n', An(1));
    for ii=2:length(An)-1,
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii),(ii-1),phaseStr);
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', Bn(ii),(ii-1),phaseStr);

    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii+1),(ii),phaseStr);

    %% An/Bn Section part 2 of 2 Cos/Sin Code for matlab
    for ii=1:length(Bn)-1,
    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1))));\n', Bn(ii+1),(ii),phaseStr);
    fclose(fid);

    %%%%--END-------------------------------------------------------%%%%

    %% %%Rebuild equation using fourier

    y2= 0.02000000+VERTOFFmain_1+VERTOFFaad_1 ...
    +
    ((AMPmain_1+AMPaaa_1)*0.114612257490144)*cos((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.983939072856305)*sin((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.996038981551664)*cos((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.153673592496372)*sin((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.036540238417196)*cos((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.008764126293635)*sin((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.016227900622921)*cos((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.007205855338253)*sin((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.010148410582892)*cos((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.005795785459515)*sin((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.007382708763096)*cos((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.004782615060476)*sin((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.005863653529250)*cos((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.004033121053173)*sin((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.004931897135657)*cos((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003455924107004)*sin((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.004316855216953)*cos((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002995548303060)*sin((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003889010894882)*cos((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002617459856575)*sin((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003579486463465)*cos((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002299260901815)*sin((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003348714604474)*cos((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002025841246293)*sin((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003172580568548)*cos((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001786644772313)*sin((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.003035683625328)*cos((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001574067328294)*sin((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002927810008406)*cos((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001382480463195)*sin((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002841974542123)*cos((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001207614781454)*sin((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002773279376576)*cos((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001046157611281)*sin((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002718221635925)*cos((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000895482668837)*sin((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002674259097213)*cos((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000753463411215)*sin((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002639530125721)*cos((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000618340787858)*sin((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002612669141481)*cos((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000488627080645)*sin((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002592683252795)*cos((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000363034046804)*sin((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002578869406576)*cos((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000240417548784)*sin((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.002570759427478)*cos((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000119733313908)*sin((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.001284042602855)*cos((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1))));


    % Plot reconstruction over data

    plot(x,y,'r',x,y2,'b--');
    hold off;

    %% %%%%---END------------------------------------------------------%%%
    %
    toc;

    Aloha
    Sal22
     
    Rick T, Sep 1, 2010
    #1
    1. Advertisements

  2. Rick T

    Greg Heath Guest

    The correct time window is given by either of

    t = linspace(0,T-dt,N)';
    t = (0:dt:T-dt)';
    t = dt*(0:N-1)';

    The corresponding period of ifft(fft(y1)) is T = N*dt
    whereas max(t) = T-dt = (N-1)*dt

    Consequently, you are not generating the correct combination
    of periodic function and time window.

    Try this:

    close all, clear all, clc
    N = 50
    T = 2*pi
    dt = T/N
    t = linspace(0,T-dt,N)';

    f0 = 1/T % Exactly, one period
    wt = 2*pi*f0*t;
    y = sin(wt)+cos(2*wt);
    C = fft(y)/N % No semicolon to display output
    absC = abs(C);
    C(absC < 1e-15) = 0 % Remove roundoff error
    No correction needed; Remember, since the fft multiplies by exp(-
    i...)
    the ifft multipies by exp(+i ...)

    Hope this helps.

    Greg
     
    Greg Heath, Sep 2, 2010
    #2
    1. Advertisements

  3. Rick T

    Rick T Guest

    Greetings

    Thanks for the quick reply Greg but I'm not sure what I did wrong
    Here's an image of my graph that my orginal code creates notice
    that the red is what the orginal code plots and the blue is what the
    re-created fourier equation produces / Plots
    image -> http://db.tt/ndAg31Q the orginal code

    The questions I had were:

    1) Is their a way to compare the y2 signal to the y signal to get a
    percentage of error/drift?
    2) Is their a way to find out how many values (x=linspace(0,1,50);) I
    would need to limit the error/drift to less than say 1%
    3) An easier way to check and calculate the Fourier expansion of the
    signal so I wouldn't have to export the y2 value out to a file than
    copy and past it back into the matlab code like I need to do now.


    I tried to use the code you so kindly sent but the image is completly
    different
    the red is the orginal equation and the blue is what I get using your
    code to produce the fourier equation did I miss a step?
    http://db.tt/ndAg31Q the code sent

    I included the changes to my code that you recommend below:

    clear all, clc

    format short g %turns off scientific notation
    tic;

    N = 50;
    T = 2*pi;
    dt = T/N;
    t = linspace(0,T-dt,N)';
    f0 = 1/T; % Exactly, one period
    wt = 2*pi*f0*t;
    y = sin(wt)+cos(2*wt);
    C = fft(y)/N % No semicolon to display output
    absC = abs(C);
    C(absC < 1e-15) = 0 % Remove roundoff error


    VERTOFFmain_1=0;
    VERTOFFaad_1=0;
    AMPmain_1=1;
    AMPaaa_1=0;
    FREQmain_1=1*2*pi;
    FREQaab_1=0;
    PHASEmain_1=0;
    PHASEaac_1=0;

    %y=y1;
    %y=y/max(abs(y))*1; % limits Amplitude
    y=y';


    N = length(y);
    C = fft(y)/N;
    A = real(C)';
    B = (imag(C)*-1)'; %I needed to multiply by -1 to get the correct sign

    % Single-Sided (f >= 0)
    An = [A(1); 2*A(2:N/2); A(N/2+1)]; %needed to put the ' to get vaules
    in rows
    Bn = [B(1); 2*B(2:N/2); B(N/2+1)]; %needed to put the ' to get vaules
    in rows

    %summary = [An Bn]

    %%%%------BEGIN-----------------------------------------------%%%%
    %% An/Bn Section part 1 of 2 Cos/Sin Code for matlab
    %%y=(AMPmain_1+aaa_1)sin((FREQmain_1+aab_1)(x-((PHASEmain_1+aac_1)/
    (FREQmain_1+aab_1))))+(VERTOFFmain_1+aad_1)

    phaseStr='(PHASEmain_1)'; %phase string used to get phase 1
    %phaseStr='(PHASEmain_2-PHASEmain_1)'; %phase string used to get phase
    180 out from phase 1

    %disp(['y=',num2str(An(1))]);
    fid = fopen('c:\users\temp\documents\matlab\1delexp.txt', 'w');
    fprintf(fid,' y2= %12.8f+VERTOFFmain_1+VERTOFFaad_1 ...\n', An(1));
    for ii=2:length(An)-1,
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii),(ii-1),phaseStr);
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', Bn(ii),(ii-1),phaseStr);

    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii+1),(ii),phaseStr);

    %% An/Bn Section part 2 of 2 Cos/Sin Code for labview mathscript
    for ii=1:length(Bn)-1,
    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1))));\n', Bn(ii+1),(ii),phaseStr);
    fclose(fid);

    %%%%--END-------------------------------------------------------%%%%

    %% %%Rebuild equation

    y2= -0.00000000+VERTOFFmain_1+VERTOFFaad_1 ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*1.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*1.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    26.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    26.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    27.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    27.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    28.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    28.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    29.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    29.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    30.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    30.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    31.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    31.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    32.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    32.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    33.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    33.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    34.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    34.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    35.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    35.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    36.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    36.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    37.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    37.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    38.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    38.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    39.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    39.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    40.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    40.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    41.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    41.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    42.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    42.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    43.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    43.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    44.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    44.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    45.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    45.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    46.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    46.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    47.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    47.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    48.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    48.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    49.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    49.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    50.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    50.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1))));



    % Plot reconstruction over data
    %hold on

    plot(t,y,'r',t,y2,'b');
    hold off;


    tia sal22
     
    Rick T, Sep 2, 2010
    #3
  4. Rick T

    Rick T Guest

    Greetings

    Thanks for the quick reply Greg but I'm not sure what I did wrong
    Here's an image of my graph that my orginal code creates notice
    that the red is what the orginal code plots and the blue is what the
    re-created fourier equation produces / Plots
    image -> http://db.tt/ndAg31Q the orginal code
    Note: I was trying to

    1) Is their a way to compare the y2 signal to the y signal to get a
    percentage of error/drift?
    2) Is their a way to find out how many values (x=linspace(0,1,50);) I
    would need to limit the error/drift to less than say 1%
    3) An easier way to check and calculate the Fourier expansion of the
    signal so I wouldn't have to export the y2 value out to a file than
    copy and past it back into the matlab code like I need to do now.


    I tried to use the code you so kindly sent but the image is completly
    different
    the red is the orginal equation and the blue is what I get using your
    code to produce the fourier equation did I miss a step?
    http://db.tt/ndAg31Q the code sent

    I included the changes to my code that you recommend below
    clear all, clc

    format short g %turns off scientific notation
    tic;

    N = 50;
    T = 2*pi;
    dt = T/N;
    t = linspace(0,T-dt,N)';
    f0 = 1/T; % Exactly, one period
    wt = 2*pi*f0*t;
    y = sin(wt)+cos(2*wt);
    C = fft(y)/N % No semicolon to display output
    absC = abs(C);
    C(absC < 1e-15) = 0 % Remove roundoff error


    VERTOFFmain_1=0;
    VERTOFFaad_1=0;
    AMPmain_1=1;
    AMPaaa_1=0;
    FREQmain_1=1*2*pi;
    FREQaab_1=0;
    PHASEmain_1=0;
    PHASEaac_1=0;

    %y=y1;
    %y=y/max(abs(y))*1; % limits Amplitude
    y=y';


    N = length(y);
    C = fft(y)/N;
    A = real(C)';
    B = (imag(C)*-1)'; %I needed to multiply by -1 to get the correct sign

    % Single-Sided (f >= 0)
    An = [A(1); 2*A(2:N/2); A(N/2+1)]; %needed to put the ' to get vaules
    in rows
    Bn = [B(1); 2*B(2:N/2); B(N/2+1)]; %needed to put the ' to get vaules
    in rows

    %summary = [An Bn]

    %%%%------BEGIN-----------------------------------------------%%%%
    %% An/Bn Section part 1 of 2 Cos/Sin Code for matlab
    %%y=(AMPmain_1+aaa_1)sin((FREQmain_1+aab_1)(x-((PHASEmain_1+aac_1)/
    (FREQmain_1+aab_1))))+(VERTOFFmain_1+aad_1)

    phaseStr='(PHASEmain_1)'; %phase string used to get phase 1
    %phaseStr='(PHASEmain_2-PHASEmain_1)'; %phase string used to get phase
    180 out from phase 1

    %disp(['y=',num2str(An(1))]);
    fid = fopen('c:\users\temp\documents\matlab\1delexp.txt', 'w');
    fprintf(fid,' y2= %12.8f+VERTOFFmain_1+VERTOFFaad_1 ...\n', An(1));
    for ii=2:length(An)-1,
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii),(ii-1),phaseStr);
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', Bn(ii),(ii-1),phaseStr);

    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*cos((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1)))) ...\n', An(ii+1),(ii),phaseStr);

    %% An/Bn Section part 2 of 2 Cos/Sin Code for labview mathscript
    for ii=1:length(Bn)-1,
    end;
    fprintf(fid,'+((AMPmain_1+AMPaaa_1)*
    %12.15f)*sin((FREQmain_1+FREQaab_1)* %6.1f *(t-((%s+PHASEaac_1)/
    (FREQmain_1+FREQaab_1))));\n', Bn(ii+1),(ii),phaseStr);
    fclose(fid);

    %%%%--END-------------------------------------------------------%%%%

    %% %%Rebuild equation

    y2= -0.00000000+VERTOFFmain_1+VERTOFFaad_1 ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*1.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    1.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*1.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    2.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    3.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    4.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    5.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    6.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    7.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    8.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    9.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    10.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    11.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    12.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    13.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    14.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    15.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    16.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    17.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    18.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    19.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    20.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    21.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    22.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    23.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    24.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    25.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    26.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    26.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    27.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    27.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    28.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    28.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    29.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    29.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    30.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    30.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    31.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    31.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    32.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    32.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    33.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    33.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    34.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    34.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    35.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    35.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    36.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    36.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    37.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    37.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    38.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    38.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    39.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    39.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    40.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    40.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    41.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    41.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    42.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    42.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    43.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    43.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    44.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    44.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    45.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    45.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    46.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    46.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    47.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    47.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    48.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    48.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    49.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    49.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*cos((FREQmain_1+FREQaab_1)*
    50.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1)))) ...
    +
    ((AMPmain_1+AMPaaa_1)*-0.000000000000000)*sin((FREQmain_1+FREQaab_1)*
    50.0 *(t-(((PHASEmain_1)+PHASEaac_1)/(FREQmain_1+FREQaab_1))));



    % Plot reconstruction over data
    %hold on

    plot(t,y,'r',t,y2,'b');
    hold off;


    tia sal22
     
    Rick T, Sep 2, 2010
    #4
  5. Rick T

    Greg Heath Guest

    This overwrites my code. Therefore, I have no idea
    of what you are talking about.

    When I cut and paste your code into an m-file it doesn't run.
    Part of the problem is that comment lines are wrapping.

    Anyway your code is too complicated. Use the formula in

    help fft

    as a guide. Use loops to implement sums.

    Hope this helps.

    Greg
     
    Greg Heath, Sep 2, 2010
    #5
  6. Rick T

    Rick T Guest

    ok I took your advice about the wrapping and
    the spectral leakage. Along with
    generating the correct combination
    of periodic function and time window.

    Aloha and thanks again for you help
     
    Rick T, Sep 4, 2010
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.