Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed
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

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_2

Step: 3

blur-text-image_3

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago