Question

Questions a) Write a (Matlab) function, which accepts the following inputs: -the finite set of Fourier series coefficients a-b) Consider the following signal 4 x(t)- 4 1- x(t) is periodic with period T-3s. Plot x(t) for the time interval t3 and t 3 (

Questions a) Write a (Matlab) function, which accepts the following inputs: -the finite set of Fourier series coefficients a-N, a-N+1,.. , a-1, ao, a1, aN-1, aN the fundamental period T of the signal to be reconstructed a vector t representing the times for which the signal will be constructed - and produces as output xv(t) (i.e., the output of the (Matlab) function should be a vector x of length equal to the length of t containing the values of xN at the times indicated by t)
b) Consider the following signal 4 x(t)- 4 1- x(t) is periodic with period T-3s. Plot x(t) for the time interval t3 and t 3 (in increments of 0.1) 2- Analytically derive the Fourier series coefficients for the signal x(t). Show all steps of your derivation. 3- Using the (Matlab) function derived in question a), plot xv(t) for N-3, 5, 11, 32, 100 for the time interval t3 and t-3. Note that you will have to write a (Matlab) code that generates the coefficients for different N 4- Analyze the results obtained in question 3 Explain why you observe the presence of high frequencies ripples in proximity of the discontinuities What do you notice about the ripples as you increase N? What you can say about the peak value of the ripples as you increase N?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)Function script:(save it as ctfss.m and neglect the error during execution)

function [y,t]=ctfss(an,T,N)
k=0;
w0=2*pi/T;
n=-N:1:N
for t=-T:0.01:T
k=k+1;
xN(k)=sum(an.*(exp(j*n*w0*t)));
end
t=-T:0.01:T
y=xN
endfunction

2)MAIN SCRIPT: save it in any name as you wish and execute after the execution of ctfss,m

a)For N=3

clc;
clear all;
close all;
T=3;tt=-3:0.1:3;
xx=(tt>=-3 &tt<=-2.25)+(tt>=-3/4 &tt<=3/4)+(tt>=2.25 &tt<=3)
figure;
subplot(221)
plot(tt,xx,'r')
xlabel('t')
ylabel('x(t)')
title('one period of x(t)')

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=3
%One period of the periodic signal
t=-1.5:0.1:1.5;
x=(t>=-3/4 &t<=3/4)
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N
subplot(222)
stem(n,abs(a))
title('Amplitude spectrum of an')
xlabel('k..>')
ylabel('|ak|')
subplot(223)
stem(n,angle(a))
title('Phase spectrum of an')
xlabel('k..>')
ylabel('<ak>')

%output xN(t) for N=3
[xN,t]=ctfss(a,T,N)
subplot(224)
plot(t,xN,'r',tt,xx,'b')
title('xN(t) for N=3')
xlabel('t')
ylabel('xN(t)')

one period of x(t) Amplitude spectrum of an 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.8 0.6 0.4 0.2 -3 2 3 3 -21 Phase spectrum of an XN(

b) ForN=5

clc;
clear all;
close all;
T=3;tt=-3:0.1:3;
xx=(tt>=-3 &tt<=-2.25)+(tt>=-3/4 &tt<=3/4)+(tt>=2.25 &tt<=3)
figure;
subplot(221)
plot(tt,xx,'r')
xlabel('t')
ylabel('x(t)')
title('one period of x(t)')

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=5
%One period of the periodic signal
t=-1.5:0.1:1.5;
x=(t>=-3/4 &t<=3/4)
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N
subplot(222)
stem(n,abs(a))
title('Amplitude spectrum of an')
xlabel('k..>')
ylabel('|ak|')
subplot(223)
stem(n,angle(a))
title('Phase spectrum of an')
xlabel('k..>')
ylabel('<ak>')

%output xN(t) for N=5
[xN,t]=ctfss(a,T,N)
subplot(224)
plot(t,xN,'r',tt,xx,'b')
title('xN(t) for N=5')
xlabel('t')
ylabel('xN(t)')

one period of x(t) Amplitude spectrum of an 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.8 0.6 0.4 0.2 -3 2 2 3 6 -4 4 Phase spectrum of an

c)For N=11

clc;
clear all;
close all;
T=3;tt=-3:0.1:3;
xx=(tt>=-3 &tt<=-2.25)+(tt>=-3/4 &tt<=3/4)+(tt>=2.25 &tt<=3)
figure;
subplot(221)
plot(tt,xx,'r')
xlabel('t')
ylabel('x(t)')
title('one period of x(t)')

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=11
%One period of the periodic signal
t=-1.5:0.1:1.5;
x=(t>=-3/4 &t<=3/4)
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N
subplot(222)
stem(n,abs(a))
title('Amplitude spectrum of an')
xlabel('k..>')
ylabel('|ak|')
subplot(223)
stem(n,angle(a))
title('Phase spectrum of an')
xlabel('k..>')
ylabel('<ak>')

%output xN(t) for N=11
[xN,t]=ctfss(a,T,N)
subplot(224)
plot(t,xN,'r',tt,xx,'b')
title('xN(t) for N=11')
xlabel('t')
ylabel('xN(t)')

one period of x(t) Amplitude spectrum of an 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.8 0.6 0.4 0.2 15 105 0 -3 2 2 3 5 10 15 Phase spect

d)For N=32

clc;
clear all;
close all;
T=3;tt=-3:0.1:3;
xx=(tt>=-3 &tt<=-2.25)+(tt>=-3/4 &tt<=3/4)+(tt>=2.25 &tt<=3)
figure;
subplot(221)
plot(tt,xx,'r')
xlabel('t')
ylabel('x(t)')
title('one period of x(t)')

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=32
%One period of the periodic signal
t=-1.5:0.1:1.5;
x=(t>=-3/4 &t<=3/4)
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N
subplot(222)
stem(n,abs(a))
title('Amplitude spectrum of an')
xlabel('k..>')
ylabel('|ak|')
subplot(223)
stem(n,angle(a))
title('Phase spectrum of an')
xlabel('k..>')
ylabel('<ak>')

%output xN(t) for N=32
[xN,t]=ctfss(a,T,N)
subplot(224)
plot(t,xN,'r',tt,xx,'b')
title('xN(t) for N=32')
xlabel('t')
ylabel('xN(t)')

one period of x(t) Amplitude spectrum of an 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.8 0.6 0.4 0.2 40 20 20 40 -3 2 Phase spectrum of an

e) For N=100

clc;
clear all;
close all;
T=3;tt=-3:0.1:3;
xx=(tt>=-3 &tt<=-2.25)+(tt>=-3/4 &tt<=3/4)+(tt>=2.25 &tt<=3)
figure;
subplot(221)
plot(tt,xx,'r')
xlabel('t')
ylabel('x(t)')
title('one period of x(t)')

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=100
%One period of the periodic signal
t=-1.5:0.1:1.5;
x=(t>=-3/4 &t<=3/4)
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N
subplot(222)
stem(n,abs(a))
title('Amplitude spectrum of an')
xlabel('k..>')
ylabel('|ak|')
subplot(223)
stem(n,angle(a))
title('Phase spectrum of an')
xlabel('k..>')
ylabel('<ak>')

%output xN(t) for N=100
[xN,t]=ctfss(a,T,N)
subplot(224)
plot(t,xN,'r',tt,xx,'b')
title('xN(t) for N=100')
xlabel('t')
ylabel('xN(t)')

one period of x(t) Amplitude spectrum of an 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.8 0.6 0.4 0.2 -50 50 -3 2 100 -100 Phase spectrum o

Add a comment
Know the answer?
Add Answer to:
Questions a) Write a (Matlab) function, which accepts the following inputs: -the finite set of Fo...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • During lab 4, we have seen numerical implementation of Fourier Series for periodic signals. As first part of this assignment, you need to write a Matlab function that would take an array representing...

    During lab 4, we have seen numerical implementation of Fourier Series for periodic signals. As first part of this assignment, you need to write a Matlab function that would take an array representing a single period of a signal (x), corresponding time array (t), and return the Fourier Series coefficients (Ck) in exponential form. The function should also be able to take two (2) optional input arguments: number of Fourier coefficients (Nk) and plot option (p). Use the template ‘fourier_series_exp.m’...

  • A periodic signal, x(t) is shown below. A = 10, T-4 sec. -T Write a MATLAB script to plot the sig...

    A periodic signal, x(t) is shown below. A = 10, T-4 sec. -T Write a MATLAB script to plot the signal, using enough points to get a smooth curve. Compute the Fourier series coefficients for the signal (if you can find them in the text, that is ok). Plot the single-sided or double-sided spectra for each signal. Include enough frequencies in the plots to adequately represent the frequency content of the signals. Plot partial sums of the Fourier series for...

  • Problem 2: A periodic signalxit) is shown below A =10, T-4 sec. -T Write a MATLAB script to plot ...

    Problem 2: A periodic signalxit) is shown below A =10, T-4 sec. -T Write a MATLAB script to plot the signal, using enough points to get a smooth curve. Compute the Fourier series coefficients for the signal (if you can find them in the text, that is ok). Plot the single-sided or double-sided spectra for each signal. Include enough frequencies in the plots to adequately represent the frequency content of the signals. Plot partial sums of the Fourier series for...

  • Use MATLAB to : ("j" is the imaginary number.) The term lo is the fundamental frequency...

    Use MATLAB to : ("j" is the imaginary number.) The term lo is the fundamental frequency of the periodic signal, 2/T, where T is the period. Frequencies nlo, where n is an integer, are the harmonics. This infinite sum is an exact representation of the original function. If we use a finite sum, where n goes from -N to N, we will get an approximation "X-(t)". In this problem we will calculate and plot the Fourier series representation of a...

  • Hello, I'm taking signal systems course. please solve this question in matlab as soon as possbile please. Question 1 a) Write a function that calculates the Continuous Time Fourier Transform o...

    Hello, I'm taking signal systems course. please solve this question in matlab as soon as possbile please. Question 1 a) Write a function that calculates the Continuous Time Fourier Transform of a periodic signal x() Syntax: [w, X] = CTFT(t, x) The outputs to the function are: w = the frequencies in rad/s, and X = the continuous Fourier transform of the signal The inputs to the function are: x-one period of the signal x(t), andt the time vector The...

  • 1. We have a signal, x (t), with period of T - 2 second with the signal in one period given below: x(t)- ^x,(t+nT) wher...

    1. We have a signal, x (t), with period of T - 2 second with the signal in one period given below: x(t)- ^x,(t+nT) wherex,) 1-2 (t - ) Kt<1 n=-oo 0 1/2 (a) Find the Fourier series coefficients for this signal. That is, find the values of ak so that x (t) Hint: te-jwt teJwt dt (b) Write some MATLAB code which will plot the signal resulting from a truncated Fourier Series using the coefficients you calculated in part...

  • PLZ shows you Matlab Code X(t) 2 2 46 1. compute the Fourier Series coefficients, ck...

    PLZ shows you Matlab Code X(t) 2 2 46 1. compute the Fourier Series coefficients, ck for the signal x(t) 2. plot magnitude of c and the phase of ck in separate plots (use subplot command) plot the Fourier Series coefficients for the square wave signal: ck(12/9) sinc(2"k/3)

  • Please help by writing a MATLAB Code for the this lab Fourier Series Synthesis You will...

    Please help by writing a MATLAB Code for the this lab Fourier Series Synthesis You will consider five continuous-time signals 1- 2- for A D 4- We were unable to transcribe this imageWe were unable to transcribe this imager(t) e-t for-1 < t > 1 x(t) 2 2 4 3 3 x(t) -4 2 2 4 2 1, 0sts be a periodic signal with fundamental period T = 2 and Fourier coefficients ak. (a) Determine the value of ao (b)...

  • 2.For the periodic DT signal shown in Top, a) determine the Fourier Series Coefficients. b) Use...

    2.For the periodic DT signal shown in Top, a) determine the Fourier Series Coefficients. b) Use MATLAB to generate a spectral plot (magnitude plot and a separate phase plot). c) Use MATLAB to generate and plot the signal as a DTFS expansion of the periodic signal. Plot over an interval containing several periods. Make sure to include the MATLAB code x[ri] -9 63 3 9 12 n 1. For the periodic DT signal shown in Top, a) determine the Fourier...

  • 1. For the function (t) below, T 2 and Vm-100 V. vt) 3 2 012 3...

    1. For the function (t) below, T 2 and Vm-100 V. vt) 3 2 012 3 (a) Sketch v'(t) and derive the Fourier coefficients for '(t). (b) Use your results from part (a) to determine for Fourier coefficients for v(t). Express your solution in the complex form of the Fourier series, nugt and verify your solution by plotting your results using Matlab. 2. Assume that the signal above is the input to the bandpass filter shown below. y (t (a)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT