# Signal approximation using linear combination of functions

How I can approximate the signal $x(t)=0.001\,t^3 \exp(-0.1t)$ in the interval $[0,100]$ using a linear combination of the following functions:

$f_1(t)=A_1$

$f_2(t)=A_2\cos(0.05t)$

$f_3(t)=A_3\cos(0.1t)$

$f_4(t)=A_4\cos(0.2t+1)\exp(-0.2t)$

$f_5(t)=A_5\,t^3$

I try to write a matlab code. Is this correct?

t=[0:100];
x_t=0.001*(t.^3).*exp(-0.1*t); %signal given for aproximation
f1_t=x_t.^0;
f2_t=cos(0.05*x_t);
f3_t=cos(0.1*x_t);
f4_t=cos(0.2*x_t+1).*exp(-0.2*x_t);
f5_t=x_t.^3;
M=[f1_t' f2_t' f3_t' f4_t' f5_t']; %matrix with linear components
A=M\x_t'; %matrix with coefficients
f_t=(A(1)*f1_t)+(A(2)*f2_t)+(A(3)*f3_t)+(A(4)*f4_t)+(A(5)*f5_t);
figure(1),plot(f_t);

• What's your question? If you execute the above MATLAB code and compare the plot against the target function $x(t) = 0.001t^2\exp(-0.1t)$, then it looks like they agree pretty well. – Jason R May 19 '13 at 20:42
• I am not sure if the right way of doing a signal aproximation is what i have implement in code. – 20317 May 19 '13 at 20:53