Question: Consider the following two functions: 1) f1(x) = sin2 (x) 2) f2(x) = ( x + if x < 0 x if 0 < x
Consider the following two functions: 1) f1(x) = sin2 (x) 2) f2(x) = ( x + if x < 0 x if 0 < x Your tasks are as follows: a) Analytically derive the expression for the coefficients of the Fourier series for each function above using the integral formulae in Eq. (2); use the period x . b) Write two separate MATLAB functions (named func1 and func2, corresponding to the two given functions above) that take the desired number of Fourier terms (N) as an input, and compute and return the Fourier series coefficients up to the Nth term. c) Based on the previous part, write a separate MATLAB .m file that performs the following tasks: Inside the script, call the two functions, i.e. func1 and func2, to estimate the FSE coefficients for N = 5, 10, 25, and 50. In two separate graphs (one corresponding to each function), plot the actual functions and their FSE for N = 5, 10, 25, and 50. For the plots use 501 equally spaced points in the range x (The linspace function is a good candidate for this task). Note that the actual function does not depend on N. Compute the Erms(x) and Emax(x) errors, i.e. Eqs. (3) and (4) respectively, for the FSEs of each function with N = 5, 10, 25, and 50. Plot the Erms(x) vs. N and Emax(x) vs. N in separate graphs for each function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
