# Signal decompositon

I am not a good in writing algorithm but please follow below steps

1.There are 4 1D sinusoidal periodic signals.3 of them are given by \begin{cases} x(t)=4\sin(10\pi t) \\ y(t)=8\cos(20\pi t) \\ z(t)=16\sin(30\pi t) \\ \end{cases} 2. 4th signal m(t) is calculated as \begin{cases} m(t)=x(t) +y(t)-z(t) \end{cases} 3.Now,draw the waveform of the signal m(t),keep it only with you and forget all other signals data.

4.Forget that m(t) is composed of 3 above signals . Now you have waveform of only one signal i.e. m(t) (not even the equation of the signal m(t))

5.Now ,I want to bring back the same above 3 signals(i.e.. x(t),y(t),z(t)) from waveform of m(t) only,

So my question is that what is the efficient way to do it?

Give solution.

Also, Is there any possibility that we could get totally different signals than above 3 signals ?

• Are the functions in question always sinusoids? If so, this would be a job for a Fourier series (if the overall period of $m(t)$ is known) or a Fourier transform. – Jason R Apr 28 '15 at 12:32
• I think your message is a bit lost in translation; I'm not sure what you're asking. – Jason R Apr 28 '15 at 16:01
• I stand by my original statement; especially if the basis functions are always sinusoids, this is a job for a Fourier transform. – Jason R Apr 28 '15 at 16:41
• That is the method of my choice. Read up on the Fourier transform and you'll see that it projects a signal onto a basis of sinusoidal functions. That's exactly what you are looking for. – Jason R Apr 28 '15 at 17:50
• looks like you did migrate the question here. – robert bristow-johnson Apr 28 '15 at 19:56

The inner product between $\sin(m \pi t)$ and $\sin(n \pi t)$ is zero if $m \ne n$. The same holds true for inner product between $\sin(m \pi t)$ and $\cos(n \pi t)$ for any integer $m$ and $n$.

You can get back $x(t)$ with the inner product between $m(t)$ and $\sin(10 \pi t)$. Remember the scaling.

Code:

N=10000;
t=linspace(-1,1,N);
x=4*sin(10*pi*t);
y=8*sin(20*pi*t);
z=16*sin(30*pi*t);
xc=1;yc=1;zc=-1;
m=xc*x+yc*y+zc*z;
xs=(1/xc)*dot(x,m)/dot(x,x);
ys=(1/yc)*dot(y,m)/dot(y,y);
zs=(1/zc)*dot(z,m)/dot(z,z);
xo=xs*x;
yo=ys*y;
zo=zs*z;
assert(norm(xo-x,'inf')<1e-14)
assert(norm(yo-y,'inf')<1e-14)
assert(norm(zo-z,'inf')<1e-14)


The code above uses a numerical discretization. The dot product are almost exact approximation of the integral. Cf. http://eprints.maths.ox.ac.uk/1734/1/NA-13-15.pdf for details.

• if possible ,can you add what steps(algorithm) you have taken for forming your code and your code output results. – pandu Apr 29 '15 at 15:55

Your question is relatively broad in the sense that the difficulty could vary greatly depending on the sampling rate, the avaible signal length and the noise.

I assume a high sampling rate of 1 kHz, 10s of available signal and no noise.

The first solution is to use a fft's magnitude, it works only if all the frequencies are different (if you have a cos and a sine with the same frequency, you'll have to check the phases too) :

Fs=1e3; %sampling frequency
T=1/Fs; %sampling period
N=10/T; %Number of points to have 10s of signal
f=Fs*linspace(0,1,N);
Fm=(1/N)*fft(m); %Normalization
Fm=2*Fm(1:length(t)/2); %Get rid of the negatives frequencies

figure, plot(f,Fm)
xlabel('frequency (hz)')
ylabel('Magnitude')


Here's a zoom on the fft's plot. Then you have to extract the peaks which is very easy if the noise is low and if you know how many peaks there is. I stress it again, it is much more difficult if you have high noise / low sampling frequency / short signal available only.

An another solution is to directly estimate your system's parameters.

$$\begin{cases} x(t)=A \sin(2 \pi f_x t) \\ y(t)=B \sin(2 \pi f_y t) \\ z(t)=C \sin(2 \pi f_z t) \end{cases}$$

You can estimate the parameter $\Theta=[A,B,C,f_x,f_y,f_z]^t$ by optimizing a least square criterion with Gauss-Newton method, let's write $C(\Theta)$ such a criterion, $m(t_k)$ your discretised measurments and $m_{\theta}(t_k)$ the model with given parameter $\Theta$.

$$C(\Theta)=\sum_{k=1}^{N} (m(t_k)-m_{\theta}(t_k))^2$$ The parameter's value $\hat{\Theta}$ we're looking for is given by : $$\hat{\Theta}=\arg_{\Theta}\min C(\Theta)$$ We find the minimum by searching $\hat{\Theta}$ such that $\nabla_{\Theta}C(\hat{\Theta})=0$

There you go with Gauss-Newton, the most difficult part being to calculate the model's gradient $\nabla_{\Theta}m_{\Theta}(t_k)$.

I assume you know how to proceed.

On a practical point of view, you may have to run the optimization routine multiple time with random initializations as it is possible that it gets stuck in local minimas.