From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 2279/CH5/EX5.4/eg_5_4.sce | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 2279/CH5/EX5.4/eg_5_4.sce (limited to '2279/CH5/EX5.4') diff --git a/2279/CH5/EX5.4/eg_5_4.sce b/2279/CH5/EX5.4/eg_5_4.sce new file mode 100755 index 000000000..ee824c03f --- /dev/null +++ b/2279/CH5/EX5.4/eg_5_4.sce @@ -0,0 +1,35 @@ +//Continuous Time Fourier Series Coefficients of +//a periodic signal x(t) = 1+sin(6t)+cos(4t) +clear; +close; +clc; +t = 0:0.01:1; +xt = 1+sin(6*t)+cos(4*t); +x_t = 1+sin(6*-t)+cos(4*-t); + +//x(t) is expanded according to Euler's theorem +x=1+(1/2)*exp(%i*4*t)+(1/2)*exp(-%i*4*t)+(1/(2*%i))*exp(%i*6*t)-(1/(2*%i))*exp(-%i*6*t); +a0=1; +a2=(1/2) +a_2=(1/2) +a3=(1/(2*%i)); +a_3=-(1/(2*%i)); +ak=[zeros(1,5) a_3 a_2 0 a2 a3 zeros(1,5)]; +k=-7:7; +disp("The fourier series coefficients are...") +disp(ak) +disp("magnitude of Fourier series coefficient") +disp(abs(ak)) +subplot(2,1,1) +plot(k,abs(ak),'.'); +xtitle("Magnitude Spectrum","k","|ak|"); +if xt== x_t then + disp("The Given signal is even. It has no phase spectrum"); +else + phase=[zeros(1,6) %pi/2 0 -%pi/2 zeros(1,6)]; + disp("Phase of Fourier series coefficient in radians") + disp(phase) + subplot(2,1,2) + plot(k,phase,'.'); + xtitle("Phase Spectrum","k","ak in radians"); +end -- cgit