import matplotlib.pyplot as plt from scipy.integrate import odeint from numpy import linalg as LA import numpy as np def mode1(x, t, m, g): y, v = X dydt = V dvdt = = = (m*g - 5*v return [dydt, dvdt] t0-0; tEnd-100 t-np.linspace(t0,tEnd, 50* (tEnd-to)) m = 85 # mass yo 100.0 # initial height ve = 0.0 # initial velocity g 9.8 # acceleration due to gravity - = y X[:, 0] V = X[:, 1] 120*y) / m # solve ODE xe = [ye, ve] X=odeint (model, X0, t, args-(m,g)) #args used for changing parameters without needing to change the whole code
import matplotlib.pyplot as plt from scipy.integrate import odeint from numpy import linalg as LA import numpy as np def mode1(x, t, m, g): y, v = X dydt = V dvdt = = = (m*g - 5*v return [dydt, dvdt] t0-0; tEnd-100 t-np.linspace(t0,tEnd, 50* (tEnd-to)) m = 85 # mass yo 100.0 # initial height ve = 0.0 # initial velocity g 9.8 # acceleration due to gravity - = y X[:, 0] V = X[:, 1] 120*y) / m # solve ODE xe = [ye, ve] X=odeint (model, X0, t, args-(m,g)) #args used for changing parameters without needing to change the whole code
Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
Related questions
Question
Below is a python code that allows us to solve a linear second-order non-homogeneous differential equation. We use the args command to allow us to change the parameter, m, without needing to rewrite the whole code. This results in a solution plot for the system corresponding to that particular value of m. But how would I generate a graph that allows me to plot multiple solutions at the same time? Write a code that will generate a plot allowing for multiple solutions for different values of m to be contained on the same graph.
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,