SpectralLines

# SpectralLines - theta_n(1 = 0 theta_n(n 1 = atan2-b_n(n 1...

This preview shows page 1. Sign up to view the full content.

clear all; close all; clc; c x = linspace(0,pi); %one period of the function y = exp(-x/2); %given function x1 = linspace(-3*pi,3*pi, 600);%repeating the function to show periodicity %plotting the given function figure; subplot(5,1,1); plot(x1/pi, [y, y, y, y, y, y]); %showing six periods grid; xlabel('t/pi'); ylabel('y(t)'); title('exp(-t/2)'); n = 1:10; a_n(1) = 0.504; a_n(n+1)=1.008./(1+16*n.^2); %cosine terms b_n(1) = 0; b_n(n+1)=0.504*8*n./(1+16*n.^2); %sine terms C_n(1) = a_n(1); C_n(n+1) = sqrt(a_n(n+1).^2+b_n(n+1).^2);%spectral amplitude
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: theta_n(1) = 0; theta_n(n+1) = atan2(-b_n(n+1), a_n(n+1));%phase n = [0,n]; n subplot(5,1,2); stem(n, a_n); ylabel('a_n'); xlabel('n'); %plot cosine terms subplot(5,1,3); stem(n, b_n); ylabel('b_n'); xlabel('n');%plot sine terms subplot(5,1,4); stem(n, C_n); ylabel('C_n'); xlabel('n');%plot spectral amplitude subplot(5,1,5); stem(n, theta_n); ylabel('\theta_n [rad]'); xlabel('n');%plot phase...
View Full Document

## This note was uploaded on 09/04/2011 for the course ES 240 taught by Professor Dr,uche during the Spring '11 term at Montgomery College.

Ask a homework question - tutors are online