问题
I need to solve this ODE using Simulink and I don't know how to make it. I only know how to do it using ODE solvers.
y'' - y' - 2y = e^(3x)
y(0)=1, y'(0)=2.
I rewrote the equation obtaining an ODEs:
y' = f(x,y)
y(x0) = y0
y'1 = y2
y2= e^(3*x) + y' + 2y
Using ODE solver.
If someone can help me to solve this using a Simulink Model I would appreciate it.
I know how to solve it in Matlab using ODE solvers as ode23 and ode23s but I don't know how to do it using a Simulink Model.
Thanks in advance
回答1:
Can you solve it in closed form? Looks doable to me. I advise anyone to have the answer in hand if possible before you start a numerical solution.
Here's what I get. Check me:
y(x) = e^(-x)*(8e^3x + 3e^4x + 1)/12
Wolfram Alpha says this is correct.
(Note: Trouble for large values of x - this response will grow at e^3x rate.)
You need to express this as a set of coupled first order ODEs.
y' = z
z' = z + 2y + e^(3x)
Boundary conditions become:
y(0) = 1
z(0) = 2
回答2:
You can set up the equation yourself term by term in Simulink and add the initial conditions to the integrators by double clicking and setting the corresponding field.
So a quick implementation looks like
I assumed that your x is a time-like quantity hence I placed a ramp function. Clock etc. would also do.
Alternatively you can form the state space system or the transfer function with explicitly taking the initial conditions into account.
来源:https://stackoverflow.com/questions/30573274/solving-ode-with-simulink-in-matlab