MATLAB Session 4

1 / 17

MATLAB Session 4 - PowerPoint PPT Presentation

MATLAB Session 4. ES 156 Signals and Systems 2007 Harvard SEAS. Prepared by Jiajun Gu. OUTLINE. Fourier series of exponential signals Fourier series of a continuous-time rectangular signal Sinc function. Fourier series of exponential signals. Fourier series of Fourier series of .

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

PowerPoint Slideshow about 'MATLAB Session 4' - nizana

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

MATLAB Session 4

ES 156 Signals and Systems 2007

Harvard SEAS

Prepared by Jiajun Gu

OUTLINE
• Fourier series of exponential signals
• Fourier series of a continuous-time rectangular signal
• Sinc function
Fourier series of exponential signals
• Fourier series of
• Fourier series of
Fourier series of exponential signals II
• Fourier series of
• What is Fourier series of
• Discrete cases?
OUTLINE
• Fourier series of exponential signals
• Fourier series of a continuous-time rectangular signal
• sinc function
Plot the series: FS generation function

function ak=series_term(k,T1,T)

% to compute Fourier series a_k

% T is the period, 2*T1 is the width of the rectangular pulses

% k is the input (integer). ak is the output

% which is the k-th term of the Fourier series

omega0=2*pi/T;

if k==0

ak=2*T1/T;

else

ak=sin(k*2*pi/T*T1)/(k*pi);

end

Plot the series: scale k-scripts

Case1: T1=1, T=20; Case2: T1=1, T=10;

for k=-30:30

a(k+30+1)=series_term(k,1,20);

b(k+30+1)=series_term(k,1,10);

end

figure;subplot(2,1,1)

set(gca,'fontsize',14);

stem(-30:30,a,'.');

xlabel('k');ylabel('a_k')

subplot(2,1,2)

set(gca,'fontsize',14);

stem(-30:30,b,'.');

xlabel('k');ylabel('b_k')

Plot the series: scale -Scripts

figure;subplot(2,1,1)

set(gca,'fontsize',14);

stem((-30:30)*2*pi/20,a,'.');

xlim([-6*pi,6*pi]) % x-axis from –6pi to 6pi

xlabel('k');ylabel('a_k')

subplot(2,1,2)

set(gca,'fontsize',14);

stem((-30:30)*2*pi/10,b,'.');

xlim([-6*pi,6*pi]) % x-axis from -6pi to 6pi

xlabel('k');ylabel('b_k')

OUTLINE
• Fourier series of exponential signals
• Fourier series of a continuous-time rectangular signal
• sinc function
Definition of sinc() function
• MATLAB has a built-in function sinc()
• Why do we want to use sinc()?
• Don’t need to write your own code.
• It can take vectors as input.
Using sinc() to calculate FS

T=10;

k=-30:30;

c=2/20*sinc(2*1/T.*k);

figure;set(gca,'fontsize',14);

stem(k*2*pi/T,c,'.');

xlim([-6*pi,6*pi])

xlabel('k\omega_0');

title('T_1=1,T=10')

Practice problems
• Find the expression of the Fourier Series of the following signals. Plot the series.
• MATLAB question in Homework 4