# How to decompose a mixed signal into its original signals?

I have generated a number of sinusoidal signals and added them together using the following Matlab code snippet:

%% Time Properties
Datapoints = 512;               % Sampling frequency
T = 1/Datapoints;               % Sampling period
Length = 512;                   % Length of signal
t = (0:Length-1)*T;             % Time vector

%% Signal Properties
signal=0;
for amp=1:10
for freq=2:5:100
for ph=0:pi/36:pi
signal=signal+amp*sin(2*pi*freq*t+ph);
end
end
end


After that I get back the original frequencies using a fast Fourier transform:

NFFT=Datapoints;
fs=Datapoints/Length;
f = fs/2*linspace(0,1,NFFT/2+1);
fftsignal=fft(signal);
fax_bins=[0:NFFT-1];
[pks,pos]=findpeaks(abs(fftsignal.^2),fax_bins);


Now pos will give me the constituent frequencies.

In addition to that I need to know the corresponding phases and amplitudes to reconstruct the original signals.

How can I get the original phase and amplitude information?

Edit 1 But pks is not giving me the constituent amplitudes.

Edit 2 For debugging I used the following code snippet:

Fs = 20000;
t = 0:1/Fs:0.01;
fc1=200;
fc2=300;
x1 = sin(pi*fc1*t);
x2 = sin(pi*fc2*t);
x=x1+x2;
x=x';
xFFT = abs(fft(x))/length(x);
[amp,freq]=findpeaks(xFFT);


I get amp=0.6252 and freq=2