Question: Python using numpy and matplotlib Based on Fourier series, a rectangle wave with a period of can be approximated mathematically by a sum of sin

Python using numpy and matplotlib
Python using numpy and matplotlib Based on Fourier series, a rectangle wave

Based on Fourier series, a rectangle wave with a period of can be approximated mathematically by a sum of sin functions as, f(x)=sin(x)+3sin(3x)+5sin(5x)+7sin(7x)++ksin(kx) Where the approximation become closer to the rectangle wave by increasing k for the total number of terms n ). 1) Write a function coefficient with two parameters: n representing the number of Fourier series tems, Ind a NumPy array x for x values in range 5 to 5 . This function should retum a Numpy array with the corresponding function f(x) or y. - Hint: note that k=2n1. [ 10 marks] 2) Use this function to plot in one figure 4 subplets, for n=1,n=4,n=20,n=100 respectively. Indude n value each subplot legend. Use different colour/marker for each subplot. Label each horizontal axis as X and each vertical axis as Y. Add tickets with at - H,0 and horizental pesitions. - Notes: you can use \$lpis to display 15 symbol, in case of overiapping labels. you can use plt.tisht_layoutl [10 marks] 3) What is the range in each subplot, l.e maximum f(x) value - minimum f(x) value. [5 marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!