Questions tagged [ode45]
140 questions
1
vote
1 answer
MATLAB error in ode45, says that it must return a column vector
Error using odearguments
@(T,Z)[Z(2),K_RUBBER/M_PLYWOODZ(3)+C_RUBBER/M_PLYWOODZ(4)-(C_RUBBER+C(J))/M_PLYWOODZ(2)-(K_RUBBER+K(J))/M_PLYWOODZ(1),Z(4),FORCING/M+C_RUBBER/MZ(2)+K_RUBBER/MZ(1)-C_RUBBER/MZ(4)-K_RUBBER/MZ(3)]
must return a column…
1
vote
1 answer
Differences between Matlab ode45 and Scipy odeint: same model different results
EDIT
So I was able to produce the correct plot, but it was only after adjusting the sampling interval to the following:
t_list = np.linspace(0, 30, 100)
which prints X as:
[1. 1. 1. 1. 1. 1.
1. 1. …

Ian
- 933
- 12
- 17
1
vote
1 answer
Not Sure How to Fix Errors Using 'ODE45' Command
I am having trouble figuring out how to fix my script, specifically using the ODE45 command.
This is what I have so far:
clc; clear all;
global I11 I22 I33 Mx My Mz w10 w20 w30 eps10 eps20 eps30 eps40 IC
I11 = 160;
I22 = 400;
I33 = 400;
Mx = 0;
My…

Scotch Jones
- 25
- 1
- 6
1
vote
1 answer
Does SciPy RK45 (solve_ivp) count the number of function evaluations accurately?
I want to measure the performance of my own ODE integrator against SciPy RK45. Thus, I need to know exactly the number of right hand side function evaluations that RK45 uses.
Does anyone know if the number sol.nfev is accurate, i.e. without…

lueckem
- 31
- 4
1
vote
2 answers
Convert ode45 code from MATLAB to a python code
How can I solve this MATLAB ode problem using python
This is the IVP with the BCs:
F'''+FF''-F'^2+1=0
F(0)=F'(0)=0, F'(oo)=1
The current matlab code will generate the following plot
and it is identical to the textbook solution:
The problem is…

ak ve
- 29
- 7
1
vote
1 answer
ode45, error in odeargument, growth kinetics
I am trying to solve this system of ODEs related to micro algae growth kinetics, I attach my function and script. I am getting some error related to the arguments. Please let me know where my error is thank you :) the system is composed of 7 ODEs…

Carmen Escalante
- 11
- 1
1
vote
0 answers
How can I translate code from a Chua attractor from Matlab to Python?
I found this code from a Chua attractor in matlab, but for a project I need to work it in Python. It happens that I don't understand how Ode45 works in this case and I haven't been able to translate it to its equivalent in python, could you explain…

Juan Manuel Realpe
- 11
- 1
1
vote
1 answer
MATLAB ode45 coupled matrix ODE
I have learned two coupled matrix ODEs for the linear quadratic tracking problem in optimal control, which are below:
where
I am trying to write a MATLAB that solves the differential equations simultaneously. Here is what I have so far:
function…

Superman
- 135
- 1
- 6
1
vote
2 answers
fsolve issue with initial condition for ODE
I am trying to solve the following ODE:
function [eta, sol] = compressible_similarity_wo
global Gamm Ma Pr omega;
Gamm = 1.4;
Ma = 2;
Pr = 0.7;
omega=0.76;
global eta_max_ode;
eta_max_ode = 20;
opt =…

Hans
- 361
- 1
- 3
- 9
1
vote
2 answers
Duplicate Equation in MatLab ODE45 Solve
I'm trying to write a MatLab code which can extend the number of ODE's to solve for simply. This is the code that I currently have, for simplicity I am starting with a spring mass damper system.
clear;clc;close all;
tspan=[0:0.01:1];
…

Bgraham
- 27
- 6
1
vote
1 answer
Solving differential equations in Matlab
I need to solve these 2 differential equations simultaneously.
dr^3/dt=(-3*D*Cs)/(ρ*r0^2 )*r*(1-C)
dC/dt=((D*4π*r0*N*(1-C)*r)-(Af*C))/V
Note: dr^3/dt is the derivative of r^3 with respect to t
The two equations resemble the change in particle…

Engineer_1331
- 15
- 4
1
vote
1 answer
When using ODE45 on MatLab, inputting numbers with many decimal places for the initial X values and rate constants are causing error messages
I have a function file:
function dxdt=function3009(t,x)
% Initialize model vector with zeroes,
dxdt=zeros(5,1);
% Parameters
%% Rate values with many decimal places causing error:
%k1= 1*10^-6; % k1*alac*lacI -> LacI-alac
%k2 = 1*10^-13; % …

Molly Steadman
- 11
- 1
1
vote
2 answers
How to fix assignment error using ode45 in MatLab (line 488 of ode45 function)
I'm trying to write a script that uses ode45 in order to integrate the equations of motion of a satellite on an hyperbolic trajectory near Mars.
I need to integrate the entire passage around the planet: starting from SOI radius (576000km) and…

Giamarcus15
- 11
- 4
1
vote
1 answer
Passing additional iteration-dependent inputs to ode45
I'm trying to solve differential equation using the ode45 function. Consider the following code,
[t1,X2] = ode45(@(t,x)fun(t,x,C1,C2,C3,C4),t0,X01);
where parameters C1, C2, C3 and C4 are column vectors, which should be available to the function…

Gladi
- 137
- 2
- 13
1
vote
2 answers
Is there a way to plot a function f with equations (from a ODE system) inside of it?
I am trying to solve this assignment for my Differential Equations class and I am encountering some problems.
Given this system of ODEs:
dy(1) = y(2) − y(3);
dy(2) = −3*y(2) − 5*sin(ω*y(1));
dy(3) = y(1)*y(2);
with omega=3. Initial values: y(1)=0;…
user9959016