Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Based on Fourier series, a rectangle wave with a period of can be approximated mathematically by a sum of sin functions as, () = sin()

Based on Fourier series, a rectangle wave with a period of can be approximated mathematically by a sum of sin functions as,

() = sin() + sin(3) 3 + sin(5) 5 + sin(7) 7 + + sin()

Where the approximation become closer to the rectangle wave by increasing k (or the total number of terms n). 1) Write a function coefficient with two parameters: n representing the number of Fourier series terms, and a NumPy array x for x values in range -5 to 5. This function should return a NumPy array with the corresponding function f(x) or y.

Hint: note that k = 2*n-1.

2) Use this function to plot in one figure 4 subplots, for n =1, n = 4, n = 20, n = 100 respectively. Include 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 -, 0 and horizontal positions. Notes: you can use $\pi$ to display symbol. In case of overlapping labels, you can use plt.tight_layout()

3) What is the range in each subplot, i.e. maximum f(x) value minimum f(x) value.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

Describe the planned-change model

Answered: 1 week ago