HW3Sol - Recall that you must calculate Co separately, and...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
% Plot the approximation given by the truncated Fourier series N = [0 1 2 3 4 10]; x = linspace(-5,5,100); Lambda = [2 4 2 2]; functionlabel = [ 'a' 'b' 'c' 'd' ]; for i1 = 1:length(Lambda) figure; titletext = sprintf( 'Function %c)' ,functionlabel(i1)); for i2 = 1:length(N) FN = zeros(size(x)); for m = -N(i2):N(i2) cm = [exp(-i*m*pi/2)/2*sinc(m/2) i*pi*m/2*exp(-i*pi*m/2)*sinc(m/2)^2 i/pi if m==0 cm(3)=0; end % needed because MatLab gives NaN for zero/zero FN = FN + cm(i1)*exp(i*2*pi*m*x/Lambda(i1)); end subplot(length(N),1,i2); plot(x,real(FN)); set(gca, 'XTick' ,[min(x):max(x)]) if i2 == 1 title(titletext) end end end function s=sinc(arg) s=sin(pi*arg)/(pi*arg); if arg == 0 s = 1; end if mod(arg,1) == 0 s = 0; end if arg == 0 s = 1; end
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
clear all clc p = -10:0.01:10; a = 1; % define functions from problem #1 fa = 1./sqrt(2.*pi).*sinc(a.*p./2./pi); fa10 = fa.^10; fb = a./sqrt(2.*pi).*(sinc(a.*p./2./pi)).^2; fb10 = fb.^10; fc = sqrt(2./pi).*a./(a.^2+p.^2); fc10 = fc.^10; % define Gaussians we are going to compare
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

HW3Sol - Recall that you must calculate Co separately, and...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online