Question: Write a MATLAB code for this problem please: Harmonic Analysis A fundamental technique of engineering analysis is Fourier decomposition - representing a periodic function as
Write a MATLAB code for this problem please:

Harmonic Analysis A fundamental technique of engineering analysis is Fourier decomposition - representing a periodic function as a sum of sine or cosine functions at multiples of the fundamental frequency. Calculate the first five non-zero terms (including the DC term) of the series for 50 % duty cycle over the domain t = [-21, 2 tt), taking m. = 1 and A = 1. Choose the step size so that you get a smooth plot (see plotting instructions below). Create one graph containing plots of: a. The fundamental term + DC offset (= 0.5) b. The sum of the first 3 terms (DC, fundamental, and 3rd harmonic) C. The sum of the first 5 terms (DC, fundamental, 3rd, 5th and 7th harmonic) d. The exact function, which can be calculated using the MATLAB built-in function square () as follows: Yuexact = 0.5+square (x + pi/2)/2; Include in graphs a. Distinguish each series clearly (i.e., with different line types, and don't forget to include a legend). b. Title your plot. Note: your title should be more informative than simply Y vs X. C. Label all axes with a name and units. (When there are no units, indicate 'unitless'). For this particular problem, assume that the time unit is milliseconds, and the amplitude unit is centimeters. Harmonic Analysis A fundamental technique of engineering analysis is Fourier decomposition - representing a periodic function as a sum of sine or cosine functions at multiples of the fundamental frequency. Calculate the first five non-zero terms (including the DC term) of the series for 50 % duty cycle over the domain t = [-21, 2 tt), taking m. = 1 and A = 1. Choose the step size so that you get a smooth plot (see plotting instructions below). Create one graph containing plots of: a. The fundamental term + DC offset (= 0.5) b. The sum of the first 3 terms (DC, fundamental, and 3rd harmonic) C. The sum of the first 5 terms (DC, fundamental, 3rd, 5th and 7th harmonic) d. The exact function, which can be calculated using the MATLAB built-in function square () as follows: Yuexact = 0.5+square (x + pi/2)/2; Include in graphs a. Distinguish each series clearly (i.e., with different line types, and don't forget to include a legend). b. Title your plot. Note: your title should be more informative than simply Y vs X. C. Label all axes with a name and units. (When there are no units, indicate 'unitless'). For this particular problem, assume that the time unit is milliseconds, and the amplitude unit is centimeters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
