That i also know ,But i am not getting how to plot second fuction ie x2(t) .They are telling exponentially decaying fuction.
Otherwise i am attaching my matlab file just find out what mistake i am doing.
clear all
close all
clc
t=linspace(0,1,1024);
y1 = sin(2*pi*30*t)+cos(2*pi*50*t) ;
for i=1:1024
ii=mod(i,50);
if ii==0
y(i)=0;
else
y(i)=exp(-20*t(ii)).*sin(20*pi*t(ii)) ;
end
end
Fs = 1024; % Sampling frequency
L = 1024;
%y3 = wgn(1,1024,0);
%y3=randn(1,length(t));
y3=wgn(1, 1024,5,20, 'dBm', 'real');
ytot=2*y1+9*y+y3;
Y=ytot;
figure(1)
plot(t,Y);
axis([0 1 -6 8])
freq = 0:1:Fs/2 ;
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y1 = fft(Y,NFFT)/L;
xf = fft(Y)/length(Y) ; % signal
xfr = xf ; % copy
xf2 = abs(Y1) ;
xf3 = xf2(1:513) ;
figure(2)
plot(freq, xf3*1024) ;
%axis([0 250 0 1.2])
xlabel('frequency in(Hz)')
ylabel('amplitude')