Amplitude in frequency domain not as expected with discontinues time domain signal
If you are seeing half the magnitude (amplitude is the height of the signal, magnitude is the size of a complex value), that means you are using a 1/N normalized DFT (BTW, my preference).  The sum will be the same (since the other half is orthogonal), you are just dividing it by twice as large of a number.  You should also find that all the even numbered bins are zero and the odd bins have values.  This is because the even bin sinusoids split evenly on your half way mark and the odd ones are integer and a half and therefore no longer orthogonal on those regions with your signal.

Hope this helps,

Ced



Followup

Demo for MBaz:

The output is:


Full: -0.000000 + i * 0.000000
Half: 230.265249 + i * 97.354586
Half Magnitude = 250.000000
Half Phase     = 0.400000


The code is:


#include &lt;math.h&gt;
#include &lt;stdio.h&gt;

//===============================================
int main( int argCount, char* argValues[] )
{

        double theSignal[1000];

        double theReal[1000];
        double theImag[1000];

        double theAngleFactor = 2.0 * M_PI / 1000;

        double theFrequency = 50.0;  // Cycles per frame

//--- Build the Arrays

        double thePhi = 0.4;

        for( int n = 0; n &lt; 1000; n++ )
        {
            double theAngle = (double) n
                            * theAngleFactor;

            double theArg = theFrequency * theAngle;

            if( n &lt; 500 )
            {
                theSignal[n] = cos( theArg + thePhi );
            }
            else
            {
                theSignal[n] = -cos( theArg + thePhi );
            }

            theReal[n] =  cos( theArg );
            theImag[n] = -sin( theArg );

        }

//--- Calculate the Bin Value

        double theBinReal = 0.0;
        double theBinImag = 0.0;

        for( int n = 0; n &lt; 1000; n++ )
        {
            theBinReal += theSignal[n] * theReal[n];
            theBinImag += theSignal[n] * theImag[n];
        }

//--- Calculate for Half the Interval

        double theHalfReal = 0.0;
        double theHalfImag = 0.0;

        for( int n = 0; n &lt; 500; n++ )
        {
            theHalfReal += theSignal[n] * theReal[n];
            theHalfImag += theSignal[n] * theImag[n];
        }

        double theMag = sqrt( theHalfReal * theHalfReal
                            + theHalfImag * theHalfImag );

        double thePhase = atan2( theHalfImag, theHalfReal );

//--- Show the Results

        printf( "Full: %f + i * %f\n" ,
                theBinReal, theBinImag );

        printf( "Half: %f + i * %f\n" ,
                theHalfReal, theHalfImag );

        printf( "Half Magnitude = %f\n", theMag );
        printf( "Half Phase     = %f\n", thePhase );
}
//===============================================




Appendum

To elaborate on my original answer.  I changed the code so the second half is defined like this, e.g. 10Hz:


                theSignal[n] = cos( 2.0 * theArg + thePhi );


Here are the sums:


Full: 230.265249 + i * 97.354586
Half: 230.265249 + i * 97.354586
Half Magnitude = 250.000000
Half Phase     = 0.400000



I left the amplitude at 1 so the magnitude of the first half unnormalized DFT is 250 (=500/2) as expected.  The sums are the same.



Epilogue - The smoking gun

Here are the unnormalized DFT calculations for the signal as specified by the OP near the bins of interest.

Bin 50 is the 5Hz bin.

Bin 100 is the 10Hz bin.

Sample rate is 100Hz.  N is 1000 for 10 seconds.

For normalized DFTs:


If you divide the left half sums by 500 (N for the left half DFT), your magnitude will be 1.0.
if you divide the whole sum by 1000 (N for the whole), your magnitude will be 0.5.


Notice that the 5Hz signal doesn't have much impact on the right side, and the 10Hz signal doesn't have much impact on the left.  As I've explained previuosly, the large values for the odd bins are due to the basis vectors in those regions being a whole integer plus a half number of cycles.



        L E F T    H A L F      R I G H T  H A L F           W H O L E
Bin       Real       Imag          Real       Imag          Real       Imag
====  =====================   =======================   =====================
 45     66.907      0.000        -7.771     -0.000        59.136      0.000
 46      0.000      0.000         0.000      0.000         0.000      0.000
 47    109.279      0.000        -7.959      0.000       101.320      0.000
 48      0.000     -0.000        -0.000     -0.000        -0.000     -0.000
 49    321.420      0.000        -8.166     -0.000       313.254      0.000
 50      0.000   -500.000         0.000      0.000         0.000   -500.000
 51   -315.264     -0.000        -8.392     -0.000      -323.656     -0.000
 52      0.000      0.000         0.000      0.000         0.000      0.000
 53   -103.118     -0.000        -8.641      0.000      -111.759     -0.000
 54      0.000     -0.000        -0.000     -0.000         0.000     -0.000
 55    -60.736      0.000        -8.915     -0.000       -69.651      0.000


        L E F T    H A L F      R I G H T  H A L F           W H O L E
Bin       Real       Imag          Real       Imag          Real       Imag
====  =====================   =======================   =====================
 95     -4.985      0.000       -65.080      0.000       -70.065      0.000
 96     -0.000     -0.000        -0.000     -0.000        -0.000     -0.000
 97     -4.714     -0.000      -107.504      0.000      -112.218      0.000
 98     -0.000      0.000         0.000     -0.000         0.000     -0.000
 99     -4.467      0.000      -319.694      0.000      -324.161      0.000
100     -0.000     -0.000         0.000   -500.000         0.000   -500.000
101     -4.240     -0.000       316.942     -0.000       312.701     -0.000
102      0.000      0.000        -0.000      0.000        -0.000      0.000
103     -4.033     -0.000       104.751     -0.000       100.718     -0.000
104     -0.000      0.000        -0.000      0.000        -0.000      0.000
105     -3.841     -0.000        62.325     -0.000        58.484     -0.000