%Frequency Shifting Property of Fourier Transform
clear all;
close all;
w=10;
A=1;
t=-10:0.01:10;
t0=exp(j*10*t);
xt=A*rectpuls(t,w).*t0
subplot(2,1,1)
plot(t,xt)
xlabel('time')
ylabel('amplitude')
title('Time-Domain Signal X(t)')
w=-8*pi:0.01:8*pi;
for i=1:length(w)
xw(i)=trapz(t,xt.*exp(-j*w(i).*t));
end
subplot(2,1,2)
plot(w,xw)
title('Fourier Transform of X(t)')
xlabel('frequency')
ylabel('amplitude')
%Time Shifting Property of Fourier Transform
clear all;
close all;
w=10;
A=1;
t=-10:0.01:10;
t0=3;
xt=A*rectpuls(t-t0,w);
subplot(2,1,1)
plot(t,xt)
xlabel('time')
ylabel('amplitude')
title('Time-Domain Signal X(t)')
w=-8*pi:0.01:8*pi;
for i=1:length(w)
xw(i)=trapz(t,xt.*exp(-j*w(i).*t));
end
subplot(2,1,2)
plot(w,xw)
title('Fourier Transform of X(t)')
xlabel('frequency')
ylabel('amplitude')
%Fourier Transform of a signal
clear all;
close all;
t=-1:0.01:1;
x= sin(2*pi*5*t)+ sin(2*pi*10*t)+ sin(2*pi*20*t);
subplot(2,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Time Domain Signal');
f=linspace(-50,50, length(t));
X = fftshift(fft(x));
subplot(2,1,2);
plot(f, abs(X));
xlabel('Frequency');
ylabel('Amplitude');
title('Frequency-Domain Signal')