تم الحل ✓
categoryهندسة حاسوب وشبكات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Problem 1 (No action is needed): A function can be defined in MATLAB by saving it into a separate
m-file. For example, Fourier series coefficients can be obtained from the code shown below.
function [X, w] = fourierseries (x, TO,N)
syms t
for k=1:N
X1(k)=int (x*exp(-1j+2*pi* (k-1)+t/To).t,0, TO)/TO;
sX(k) subs (X1(k));
w(k)=(k-1)*2*pi/TO;
end
end
Upon saving this code by the name 'fourierseries', calling this function by 'fourierseries' in any other
program returns the coefficients.
For example, we want to obtain and plot the Fourier series coefficients for the signal r(t) shown below.
2(t)
-1.25 -0.75
-0.25 0.25 0.75
1.25
To=1
The following code calculates the coefficients, plots the signal r(t) for the specified period, the magnitude
D. versus nuo, and the phase ZD, versus no.
clear all;
clf
a syms t
TO=1;N=20;
sm-heaviside (t)-heaviside (t-T0/4)+heaviside (t-3-T0/4);
x=2m;
[X1, wl] fourierseries (x, TO,N);
X=[conj (fliplr (X1 (2:N))) X1];w=[-fliplr (w1 (2:N)) w1];
figure (1)
10 subplot (2,2,[1,2])
ezplot (x. [0 T0]); grid; title (Period of x(t)')
12 subplot (2,2,3)
13
stem (w, abs (X)); grid; axis ([min (w) max (w) -0.1 1.1]);
14 title("Magnitude spectrum')
xxlabel("n\ongga.0 (rad/sec)"); ylabel( |Dân")
16 subplot (2,2,4)
stem (w.-angle (X1 (2:N)) angle (X1)]); grid; title('Phase spectrum)
saxis ([min (w) max(w) -3.5 3.5]);
mxlabel('n\omega_0 (rad/sec) ):ylabel( \angle{D.n} )
The output of this code is displayed below.
SN
24
Magnitude spectrum
04
Phase spec
29
.
Alternatively, Fourier series coefficients can be obtained numerically using the Discrete Fourier Transform
(to be covered in Digital Signal Processing course). You may use the procedure outlined in Example C6.4
on page 659 in the textbook.
Problem 2:
Using the aforementioned procedure, for each signal in Problem 6.1-1 on page 669 in the textbook, plot one
period of z(t), its magnitude spectrum |D| versus nuo and its phase spectrum ZD, versus no
-3
0
(a)
П
F
20m
-10m
(b)
10T
20
1
www
-6T
(c)
4
8--
А
лл
-5
-/4
(d)
1/4
^ \\ ^ ^ Z
-3-2
-6
(c)
1
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.