Write a MATLAB user-defined function that calculates the coefficients of the inf
ID: 661710 • Letter: W
Question
Write a MATLAB user-defined function that calculates the coefficients of the infinite Fourier series using the general definition of the Fourier series (Eq. (7.14)) where the coefficients Ak and Bk are given by Eqs. (7.15)-(7.17). Name the function [Ak,Bk] = FourierCoe(Fun,a,b, k). The output arguments Ak and Bk are the Fourier coefficients Ak and Bk, respectively. The input argument Fun is a name for the function that calculates f(x) for a given x (it is a dummy name for the function that is imported into FourierCoe), a and b are the points that define the interval, and k is the index. The FourierCoe function uses the MATLAB built-in function quad for the integration. Use the FourierCoe function to calculate Ak and Bkkfor, k = 1,5, and 10 with f{x) = x for0lexlel.Explanation / Answer
Fourier series:
Applied on functions that are periodic. A periodic function is broken down and expressed in terms of sine and cosine terms. In mathematics, the term