Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help with python 1: HW06a.py Solving transcendental equations with scipy: 1. Given the equation for the intrinsic carrier density ni2=BT3exp(ar) find the value of T

help with python
image text in transcribed
image text in transcribed
image text in transcribed
1: HW06a.py Solving transcendental equations with scipy: 1. Given the equation for the intrinsic carrier density ni2=BT3exp(ar) find the value of T (in degrees Keivin) for a given value of ni a. Write a python script with a function def Find Tini, min, max, element) which retums the corresponding value for T 1. It includes optional arguments min and max to limt the search space for the solution T. Min should default to 1 and max to 1000 ii. Optonal argument element is either "SI "Ge' or "GeAs". It should detaul to "Sir and choose the correct constants based on its value. iii. If no solution is found is should raise a ValueErnor eaception b. Include in your python script a main function which takes ni min max element as command line arguments and prints the value for T as " T={2e/F i. Call it from the command line for exampie: 1. Swo6a py 10e10100400Si i. min, max and element are optional and should only be used it provided. ii. If it fails it should print "No solution", an explanation of what went wrong and return -1 2: hw06b.py solving simultaneous equations using sympy Given the following 3 simultaneous current equations for this transistor circuit, solve for id, Vo and Vs ID=Kn(VDDVnVTN)2(1+(VDDVn))ID=Kn(VgVnVTN)2(1+(VeVp))ID=Kn(VsVTN)2(1+VD) 1. A: write a function solve(Kn, VDD, Vg. Vtn, lambda) which returns (Id, Vo, Vs) as a tuple. a. It should default Vtn=1 and lambda=0 if they are not given. b. Since it is a polynomial function it will have many solutions. Some will be complex some will be real, but invalid, but only one should solve the circuit. Use a for loop to go through the solutions returned by sym.solve and only retum teh valid one. i. Make sure it only returns real valued answers. Sometimes the value will be reported as complex due to rounding errors even though it is real. So if it is complex look at the imaginary part and see if it is negligibly small (1+j1e25) is actually real ii. Verify that the answers are valid for the given problem. 1. Since this circuit has no negative supply. Vs, Vo and Ig must be positive. 2. Since this circuit is powered by a DC supply = VCC, no voltages can be above VCC iii. If no solution is found it should raise a ValueError exception. 2. Include a main function that takes KnVddVgVtn and Lambda as command line arguments and prints the answer as a. "dd=(;2e)Vo=(;2e)Vs=(:2e) b. If no valid solution is found, then main program should print "No solution found" and retum 1 c. For example: shw06b.py 1e-35310.1 L. Should print "id =2.94e04Vo=3.49e+00Vs=1.51e+00 3: HWo6c py Creating graphs with matplotib, reading data from files: 1. Use numpy or pandas to read a spice output file and plot it as the three currents vs time. With the x axis being time and the y axis being the current in mA. a. You could also read the data with a simple for loop, but numpy and pandas makes it much easier. 2. The data is in the file "data correct" in the test directory 3. Label the plot "Spice Output" and the x-axis time (sec)" and the y-axis "current (mA)" 4: HW06d.py Complex math with scipy or python controls libraries In circuits, signals and controls you will come across complex numbers and algebra quite often. Scipy and its associated libraries and python controls library will help you make quick work of these jobs. Circuit responses and physical systems are often modeled using Laplace transforms and the complex " s " domain. Given a complex polynomial H(s)=(a+6)(x+12)(x+5)5(t+5)(a+3)(a+1) 1. Plot the Bode Plot response from frequencies 10mHz to 10Hz 2. Plot the poles and zeros locations The input files I will test against are in the "test" directory Python has a huge set of libraries that you will find invaluable in your school and career. This assignment introduces you to some basic tools you will use in most of your ECE classes so make sure to do it well and save these files for later to use as templates. You generally want to define library functions in your code, but you may also want to execute them directly by defining a main function like this: def main(): print("Hello World!") if __ name_ ==" main " : main() To make a python script directly executable you must include the execution command as the first line \#!/usr/bin/env python 3 And you must tell linux to allow it to be executed by giving it executable permission by executing the chmod command chmod +x hw0 6apy For this assignment all python scripts MUST be written as function definitions and an executable main function. The functions must all be properly documented using docstrings for full credit. I will check by calling help() on each function. https://peps.python.org/pep-0257/ In your circuit analysis classes you will always be writing simultaneous sets of equations to find node voltages or currents. This is a pain if done by hand and some equations can only be solved numerically so that is where sympy and scipy come in handy

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 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

6-25. IMHO, our quad turbo sprayer is best model 4U.

Answered: 1 week ago

Question

6-27. FWIW, I use the L400 myself & it rocks.

Answered: 1 week ago