Prerequisite: You will be using utils.py from Python 2 Assignment Task 1) In utils.py, add a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Prerequisite: You will be using "utils.py" from Python 2 Assignment Task 1) In "utils.py," add a Python function called "calculate_fourier_coefficients" that calculates the coefficients of a Fourier Series for a given periodic function f (x). The function should return a list of tuples, where each list element represents the nth harmonic coefficients (an, bn ) for n = = 0... N where N denotes the maximum harmonic. Task 2) In "utils.py," add a Python function called "approximate_fourier_series" that approximates the original function using a Fourier Series with a specified number of harmonics. The function should return a Numpy array with the resulting approximated signal. Task 3) Write a Python (.py) script called "fourier_series.py" that computes the Fourier Series approximation of a periodic square wave function using L = 1, 3, 5, 7 harmonics. The script should also plot (see example below) the original function and all approximations. Your submission should include the following files: ● A Python (.py) file called "utils.py" containing the implementation of the Fourier Series functions. ● A Python (.py) file called "fourier_series.py" containing the script demonstrating the usage of the Fourier Series functions. Prerequisite: You will be using "utils.py" from Python 2 Assignment Task 1) In "utils.py," add a Python function called "calculate_fourier_coefficients" that calculates the coefficients of a Fourier Series for a given periodic function f (x). The function should return a list of tuples, where each list element represents the nth harmonic coefficients (an, bn ) for n = = 0... N where N denotes the maximum harmonic. Task 2) In "utils.py," add a Python function called "approximate_fourier_series" that approximates the original function using a Fourier Series with a specified number of harmonics. The function should return a Numpy array with the resulting approximated signal. Task 3) Write a Python (.py) script called "fourier_series.py" that computes the Fourier Series approximation of a periodic square wave function using L = 1, 3, 5, 7 harmonics. The script should also plot (see example below) the original function and all approximations. Your submission should include the following files: ● A Python (.py) file called "utils.py" containing the implementation of the Fourier Series functions. ● A Python (.py) file called "fourier_series.py" containing the script demonstrating the usage of the Fourier Series functions.
Expert Answer:
Answer rating: 100% (QA)
Answer import numpy as np import matplotlibpyplot as plt from utils import calculatefour... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
What is the output of this program? #include void test(int *, int *); int main() { int a = 5, b=6; test(&a,&b); printf("%d %d",a,b); return 0; } void test(int *p, int *q) { *p = *p**q; *q= *p+*q;...
-
To demonstrate the ability to propose, implement, and query the database. Problem: MovinOn Inc. is a moving company that provides moving and storage services in California, Nevada, and Arizona....
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Access various employment Web sites (for example, www.monster.com and www.dice.com ) and find several job descriptions for a database administrator. Are the job descriptions similar? What are the...
-
Three forces act on the bracket. Determine the magnitude and direction θ of F1 so that the resultant force is directed along the positive x' axis and has a magnitude of FR. Units Used: kN = 103...
-
Write a helper method reverse which takes in a string and returns the string backwards. For example, if given "Hello", it will return "olleH" o Hints (you don't have to use these, but they may be...
-
Define the difference between process and function and provide an example.
-
A company is trying to determine the proper capacity level for its new electric car. A unit of capacity provides the potential to produce one car per year. It costs $10,000 to build a unit of...
-
Simple Harmonic Motion Introduction: Simple harmonic motion, as shown in Figure 1, is any motion that has a restorative force and forces the object to oscillates indefinitely in the absent of...
-
This assignment requires you to complete the 2022 tax reporting for a fictional woman named Anna Smith. Question 1 T1 - step 4 - line 66 This is Anna's taxable income Answer: Question 2 T1 - step...
-
4. Figure 5 shows a mechanical power transmission using geared system. Electric motor A delivering power to appliance at though gears at B, C, D and E. The dimension notations are given in Table 2...
-
The technique of fluorescence in situ hybridization involves the use of a ___________ that hybridizes to a ____________. a. radiolabeled probe, band on a gel b. radiolabeled probe, specific site on...
-
Describe the important features of cloning vectors. Explain the purpose of selectable markers in cloning experiments.
-
A point mutation could be caused by a. depurination. b. deamination. c. tautomeric shift. d. any of the above.
-
What is the functional significance of sticky ends in a gene cloning experiment? What type of bonding makes the ends sticky?
-
One way that TNRE may occur involves the formation of _________ that disrupts ____________. a. a double-strand break, chromosome segregation b. an apurinic site, DNA replication c. a hairpin, DNA...
-
7. Electrical resistance is analogous to a) Inertia b) Dampers c) Spring d) Fluid capacity 8. O type system has a) Zero steady state error b) Small steady state error c) High gain constant d) Higher...
-
Sheldon and Leonard had a million-dollar idea. In order to make it happen, they have to do special research first. Only Kripke can help them in this matter. But Kripke is known to be the first-class...
-
Write a program that has main() call a user-defined function that takes a Celsius temperature value as an argument and then returns the equivalent Fahrenheit value. The program should request the...
-
Construct logical expressions to represent the following conditions: a. weight is greater than or equal to 115 but less than 125. b. ch is q or Q. c. x is even but is not 26. d. x is even but is not...
-
Write a statement that assigns the sum of the first and last elements of the array in Question 3 to the variable even. Data From Question 3 Declare an array of five ints and initialize it to the...
-
A nickel crystals work function is measured to be 5.22 eV at 25C. As the temperature increases by 300C, the work function drops by 50 meV. By how much does this shift the threshold wavelength for...
-
A crystal sample of bacteriorhodpsin, a light-sensitive protein found in halobacteria that responds to light energy, has crystal planes separated by 0.20 nm. If a beam of 11 keV x rays illuminates a...
-
Investigators have created structures consisting of linear chains of ionized atoms on a smooth surface. Electrons are restricted to travel along the chain. The energy levels of the electrons match...
Study smarter with the SolutionInn App