Questions tagged [ode45]

140 questions
0
votes
1 answer

Solving six differential equations with ODE 45 solver without defining y terms? Matlab

I am trying to solve differential equations by using ode45 solver. However, it does not work as expected. function ydot=Untitledrt(z,y) ydot = zeros(6,1); %y(1)=A %y(2)=B %y(3)=C %y(4)=D %y(5)=P %y(6)=T m1 = 6; …
0
votes
0 answers

ode45 vector valued function

Hy I have a column vector called theRas. It represents the Reduced Adjoint system in an Optimal Control problem. It is a [10 * 1] Column vector. It is of the form theRas(z1, z2, z3, z4, z5, lam1, lam2, lam3, lam4, lam5) =...... It is basically 10…
Sedzani
  • 1
  • 1
0
votes
1 answer

Too Many Input Arguments Matlab ode45

I am trying to write a simple Matlab code to model a projectile. Whenever I try to run the code I get an error saying there are too many input arguments. I am running the code with model1(44.7, 45) function[] = model1(vel, angle) close all; tspan…
Olivia
  • 37
  • 3
0
votes
1 answer

MATLAB error at line with ode45

Im trying to get matlab to display a graph of prey vs predetor function [ output_args ] = Untitled( input_args ) options = odeset('RelTol', 1e-4, 'NonNegative', [1 2]); [t,x] = ode45('lotka_volterra', [0 30], [2 1], options); …
0
votes
1 answer

Sweeping initial conditions for a set of ODEs using parfor

I am currently trying to use parfor to sweep across a range of initial conditions for a set of differential equations solved by ode45. The code works fine using two nested for loops but I was hoping parfor could make the process more efficient.…
ksm
  • 1
  • 1
0
votes
1 answer

Solving a system of 4 second order ODE's in matlab using ODE45

I need to solve this system of second order equations using ODE45 in matlab I'm only familiar with using ODE45 with maybe one or two equations but not this many Here is what I have but I'm not sure how to correct it: function second_oder_ode t =…
ful1meta1
  • 21
  • 1
  • 6
0
votes
0 answers

Not enough input arguments while solving ODE in matlab

I am trying to solve 3 ODE's that are actually rate equations.This is how i intend to represent the equations and furthur solve them using ODE45 in MATLAB. function dy=rate1(t,y) dy=zeros(3,1); k1=1; k2=2; dy(1)=-k1*y(1); …
0
votes
1 answer

Is there a way to stop ode(any) in matlab after a point other than time?

Usually any ode like ode23, ode 45 will do the integration from initial time to final time [t0 tf]. Is there a way, the integration can be stopped on some other parameter not dependent on time? For example, I have a linear damper. Initial Pressure…
0
votes
0 answers

ode45 with Two Degrees of Freedom MATLAB

I am trying to solve a differential equation with the ode45 function that involves two degrees of freedom, the x and y directions. When in my oem function below I am trying to store all four variables that I need into a matrix to plug into the…
0
votes
0 answers

How to use extra time varying discrete inputs in Ode45?

For example as shown in the function below: Where Ts is the variable with initial value, while Qu is input but it changes with time having specific values defined in the matrix. M-file: function…
0
votes
0 answers

How to interpolate a vector and work with variables (ode45)?

I'm working with an ODE model the one I have to put a vector in a variable and then solve it, but I have some parameters which depends on some of the equations of the model, like auxiliar functions/equations but I get this error: Error using…
Ana Olay
  • 3
  • 2
0
votes
1 answer

how to importing m-file with internal function to simulink?

my problem is some hard to describe, but I try to express in the best. I have a model with a main file by the name 'main.m' with some codes. in 'main.m' file I used ode45 to solve differential equations. here's my 'main.m' codes: [t,x]=ode45(@vdp,[0…
Vahid_EL
  • 13
  • 1
  • 5
0
votes
1 answer

Can't recover the parameters of a model using ode45

I am trying to simulate the rotation dynamics of a system. I am testing my code to verify that it's working using simulation, but I never recovered the parameters I pass to the model. In other words, I can't re-estimate the parameters I chose for…
M.A.
  • 169
  • 1
  • 1
  • 18
0
votes
1 answer

MATLAB - How to read a single value from a vector? (ode45 involved)

I'm trying to work with a code that involves ode45, in the one in the equation that will be solved I have to introduce a single value from a vector that will change depending on the time the equation is solved, I mean if it is x=x(0) then u1(1) and…
Ana Olay
  • 3
  • 2
0
votes
0 answers

MatLab Numerically Solving ODE for Circuit Problems

So I am trying to solve numerically an ODE for a pretty simple circuit. In series Voltage source, Resistor, Capacitor 1, Capacitor 2 and then Inductor. I have found the the values as R=2ohm, C1=3, C2=4 and Inductor=1 and Vin = 12e^(-0.5t) I am now…
ANT1
  • 9
  • 1
1 2 3
9
10