1. (65 points) Write a Python program to draw Bode plots for a pathway of arbitrary length. The program should use the transfer function equation (SI - A)¹B that we discussed in class to compute the amplitude and phase plots. A python function to compute B is provided for you. See end of assignment. The program should be split into python functions rather than be one block of code. For exam- ple, you might have specific functions to compute the amplitude and phase given a complex number, you might have a function that does the actual plotting of the Bode plots. Use the subplot feature of matplotlib to plot the amplitude and phase plots side by side. Add appropriate labeling to the x and y axis and make sure each plot has a title to indicate what kind of plot it is. Here is an example of what a plot might look like: Decibels Amplitude Plot Phase Plot 0 0 -10 -25 -20 -50 -30 -40 Degrees -75 -100 -50 -125 -60 -150 -70 -175 -80 10-5 10-3 10-1 Frequency, rad/sec 10¹ 10-5 10-3 10-1 Frequency, rad/sec 10¹ For extra credit you can also add a grid to both plots. You should test and confirm that your program gives the correct Bode plots for a first order model such as: r te.loada (')) ''') $Xo -> x1; k1*Xo x1 ->%; k2*x1 Xo = 1 k1 0.6; k2 = 1.8%; You can use WolframAlpha to confirm that your program is working correctly. For example, the following command will generate the Bode plots for a first-order transfer function. Bode plot of the transfer function 3/(s+1) Obviously to do this you will need to derive the transfer function in order to obtain the coeffi- cients.

Introductory Circuit Analysis (13th Edition)
13th Edition
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:Robert L. Boylestad
Chapter1: Introduction
Section: Chapter Questions
Problem 1P: Visit your local library (at school or home) and describe the extent to which it provides literature...
icon
Related questions
Question

Help with homework, with the extra portion part too please

1. (65 points) Write a Python program to draw Bode plots for a pathway of arbitrary length.
The program should use the transfer function equation (SI - A)¹B that we discussed in class
to compute the amplitude and phase plots.
A python function to compute B is provided for you. See end of assignment.
The program should be split into python functions rather than be one block of code. For exam-
ple, you might have specific functions to compute the amplitude and phase given a complex
number, you might have a function that does the actual plotting of the Bode plots.
Use the subplot feature of matplotlib to plot the amplitude and phase plots side by side. Add
appropriate labeling to the x and y axis and make sure each plot has a title to indicate what
kind of plot it is. Here is an example of what a plot might look like:
Decibels
Amplitude Plot
Phase Plot
0
0
-10
-25
-20
-50
-30
-40
Degrees
-75
-100
-50
-125
-60
-150
-70
-175
-80
10-5
10-3 10-1
Frequency, rad/sec
10¹
10-5
10-3
10-1
Frequency, rad/sec
10¹
For extra credit you can also add a grid to both plots.
You should test and confirm that your program gives the correct Bode plots for a first order
model such as:
r te.loada ('))
''')
$Xo -> x1; k1*Xo
x1 ->%; k2*x1
Xo = 1
k1
0.6; k2 = 1.8%;
You can use WolframAlpha to confirm that your program is working correctly. For example,
the following command will generate the Bode plots for a first-order transfer function.
Bode plot of the transfer function 3/(s+1)
Obviously to do this you will need to derive the transfer function in order to obtain the coeffi-
cients.
Transcribed Image Text:1. (65 points) Write a Python program to draw Bode plots for a pathway of arbitrary length. The program should use the transfer function equation (SI - A)¹B that we discussed in class to compute the amplitude and phase plots. A python function to compute B is provided for you. See end of assignment. The program should be split into python functions rather than be one block of code. For exam- ple, you might have specific functions to compute the amplitude and phase given a complex number, you might have a function that does the actual plotting of the Bode plots. Use the subplot feature of matplotlib to plot the amplitude and phase plots side by side. Add appropriate labeling to the x and y axis and make sure each plot has a title to indicate what kind of plot it is. Here is an example of what a plot might look like: Decibels Amplitude Plot Phase Plot 0 0 -10 -25 -20 -50 -30 -40 Degrees -75 -100 -50 -125 -60 -150 -70 -175 -80 10-5 10-3 10-1 Frequency, rad/sec 10¹ 10-5 10-3 10-1 Frequency, rad/sec 10¹ For extra credit you can also add a grid to both plots. You should test and confirm that your program gives the correct Bode plots for a first order model such as: r te.loada (')) ''') $Xo -> x1; k1*Xo x1 ->%; k2*x1 Xo = 1 k1 0.6; k2 = 1.8%; You can use WolframAlpha to confirm that your program is working correctly. For example, the following command will generate the Bode plots for a first-order transfer function. Bode plot of the transfer function 3/(s+1) Obviously to do this you will need to derive the transfer function in order to obtain the coeffi- cients.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:
9780133923605
Author:
Robert L. Boylestad
Publisher:
PEARSON
Delmar's Standard Textbook Of Electricity
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:
9781337900348
Author:
Stephen L. Herman
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Electrical Engineering
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education
Fundamentals of Electric Circuits
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:
9780078028229
Author:
Charles K Alexander, Matthew Sadiku
Publisher:
McGraw-Hill Education
Electric Circuits. (11th Edition)
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:
9780134746968
Author:
James W. Nilsson, Susan Riedel
Publisher:
PEARSON
Engineering Electromagnetics
Engineering Electromagnetics
Electrical Engineering
ISBN:
9780078028151
Author:
Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:
Mcgraw-hill Education,