Question: Problem 4 Every periodic function can be represented by a Fourier Series, i.e. a superposition of an infinite number of sines and cosines. For the

Problem 4 Every periodic function can be represented by a Fourier Series, i.e. a superposition of an infinite number of sines and cosines. For the square wave: y(x)-sgn sin the Fourier series is -().& given as: (x) Write a MATLAB function to calculate y, (x) given the following input: L 0), N (positive odd integer) and x (vector of points over which the function is computed). The MATLAB function should be called by a MATLAB code (script), as part of it "Analysis" section. The input the to MATLAB script should be: N, L, and dr. Using this input, the code should generate a vector x=[ 0:dx:2*L] and, then, call the function (which you will develop) to calculate y,(x) The input to the MATLAB function should be x, N, and L. The output should be a variable yf that include y, (x) at al discrete locations of x. Use you code and function to calculate y,(x) for L 1.5, N 13, andx -[0:dx:2L], and over-plot it with the square wave, y(x), for the same x. The plot commands should be in the main script (not the function). In making your code, make sure follow the General Program Structure from the first pages of the ted notes. In making your plot, make sure follow the General Plot Structure from the posted notes, and include gridlines, axes labels, title, solid and dashed lines of blue and red colors, no markers, and legends
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
