blob: 80f039a90d675b1c3cb460ff8dc93efde4afc009 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
//Graphical//
//Example 4.1.2 Continuous Time Fourier Transform
//and Energy Density Function of a Square Waveform
// x(t)= A, from -T/2 to T/2
clear;
clc;
close;
// Analog Signal
A =1; //Amplitude
Dt = 0.005;
T = 4; //Time in seconds
t = -T/2:Dt:T/2;
for i = 1:length(t)
xa(i) = A;
end
//
// Continuous-time Fourier Transform
Wmax = 2*%pi*2; //Analog Frequency = 2Hz
K = 4; k = 0:(K/800):K;
W = k*Wmax/K;
disp(size(xa))
Xa=xa'*exp(-sqrt(-1)*t'*W)*Dt;
Xa = real(Xa);
W = [-mtlb_fliplr(W), W(2:501)]; // Omega from -Wmax to Wmax
Xa = [mtlb_fliplr(Xa), Xa(2:501)];
ESD = Xa^2; //Energy Density Spectrum
subplot(3,1,1);
plot(t,xa);
xlabel('t in msec.');
ylabel('xa(t)')
title('Analog Signal')
subplot(3,1,2);
plot(W/(2*%pi),Xa);
xlabel('Frequency in Hz');
ylabel('Xa(jW)')
title('Continuous-time Fourier Transform')
subplot(3,1,3);
plot(W/(2*%pi),ESD);
xlabel('Frequency in Hz');
ylabel('SXX')
title('Energy Density Spectrum')
|