lab5 - Lab 5 Fourier Series in Maple and Matlab Case of a...

This preview shows pages 1–3. Sign up to view the full content.

Page 1 - 9 Lab 5: Fourier Series in Maple and Matlab Case of a Sine Series for an Odd Function Calculate the Fourier coefficients for the periodic function shown below. Note the function is ODD and so only has sine coefficients. a. Begin by opening Maple . Set up notation for the unit step and sawtooth functions. > alias(u=Heaviside): Saw := t -> t-floor(t): b. Define the function over the "seed interval" which in this case is from 0 to 4. > x := t -> -3*u(t) + 3*u(t-1) + 3*u(t-3): c. To obtain and plot the periodic extension, using T0=4, we define: > P := t -> 4 * Saw(t/4): xp := t -> x(P(t)): > plot( xp(t), t=-4. .4, thickness=2, discont=true); d. To obtain the Fourier coefficients, we need only find the sine terms B n since the periodic extension of the function is odd. The sine coefficients are given by an Euler integral. > T0 := 4: w0 := 2*Pi/T0: > B := n -> (2/T0) * int( x(t) * sin(n*w0*t), t=0. .T0): > for n from 1 to 10 do B||n = B(n) od; Note: The notation B||n is short for the concatentation of B with n to obtain Bn. In the same way, check that: > Cat||fish; returns the single concatenated word Catfish.

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

View Full Document
Page 2 - 9 e. Can you see the pattern? The assume command should help. The pattern is best seen by looking at the integers mod 4. > assume(k, integer); B(4*k); B(4*k+1); B(4*k+2); B(4*k+3); Verify the following: If n = 4k, we get B(4k) = 0 If n = 4k+1, we get B(4k+1) = -6/(n*Pi) If n = 4k+2, we get B(4k+2) = -12/(n*Pi) If n = 4k+3, we get B(4k+3) = -6/(n*Pi) f. Fourier Synthesis . Let's combine the terms and plot the approximation out to 10th order. > k := 'k': X := t -> sum(B(k) * sin(k*w0*t), k=1. .10): > plot( {xp(t), X(t) }, t=-4. . 4 , numpoints=200 ); The value of superimposing your Fourier approximation over the original periodically extended function, is that you can see at a glance whether the Fourier approximation is correct. This is a great way to check your homework calculations. Try even larger values such as k = 50, 100 or even 500. No matter how many terms you use, the overshoot at
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 9

lab5 - Lab 5 Fourier Series in Maple and Matlab Case of a...

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

View Full Document
Ask a homework question - tutors are online