For the following piecewise function: (a) Express y(x) as a Fourier series, (b) Write aMATLAB program that
Question:
For the following piecewise function:
(a) Express y(x) as a Fourier series,
(b) Write aMATLAB program that computes the value of the Fourier series for n = 10, n = 100 and n = 1000 using a grid in x that is linearly space from [−1, 1] using 101 points. The program should automatically plot these three functions to the screen.
(c) Write a MATLAB program that determines the value of the error,
where yn is the approximation from the Fourier series using n terms and y∗ is the exact value of the function, for n = 1, 2, . . . , 1000. You can use the MATLAB function norm(x) to compute the norm. The program should automatically create a semilog-x plot of this error as a function of the number of terms n. Explain why the error does not go to zero for n ≫ 1. The quantity || . . . || is a vector norm.
Step by Step Answer:
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis