Questions tagged [ode]

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable.

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable. Equations of this type can be solved numerically or analytically.

1902 questions
0
votes
1 answer

Is it possible to export additional variables from within an ODE45 function?

I have an equation of motion function file which I feed into ode45. Necessarily, the output variables of the function file is ydot. Within my equation of motion function file, I calculate many objects from the state vector, y, to prescribe…
Evan
  • 71
  • 2
0
votes
2 answers

Octave: is it allowed to have a for() cycle in a function definition?

I have a function func() definition which contains a for() cycle. Can I then pass func() to lsode() to be resolved as an ODE? Update: Example of the code. int = [0; 0]; slp = [0; 1]; x = [1:10]; r = zeros(1,10); for id = 1 : 2; r = r + int(id) +…
Fabio Capezzuoli
  • 599
  • 7
  • 23
0
votes
1 answer

Is Julia ForwardDiff applicable to very comprehensive function involving ODE integration and nested automatic differentiation?

I need to estimate parameters of continuous-discrete nonlinear stochastic dynamic system using Kalman filtering techniques. I'm going to use Julia ode45() from ODE and implement Extended Kalman Filter by myself to compute loglikelihood. ODE is…
konstunn
  • 355
  • 4
  • 17
0
votes
2 answers

Plotting solution to ODE using rk4 - python

I want to plot of o vs t0 after I have written the following: N = 100 t=0.0 m = [0.0, pi/2, 0.0] o=[0 for j in range(0,N)] p=[0 for j in range(0,N)] for j in range(0,N): (t,theta) = runkut(2, t, m, 1.0/N) o[j] = m[1] p[j] = …
ak19
  • 9
  • 4
0
votes
1 answer

Optimise an ODE and recalculate the initial value in R

I was wondering if I could have some input in the following problem: I try to have an optimal value returned for my function, after using modCost and modFit to get results. So what essentially I try to do is toy around with a basic forecast,…
P.Galanis
  • 1
  • 1
0
votes
1 answer

speed problems with odesolver in R

I have a differential equation model in R that uses the odesolver from the deSolve package. However, at the moment the model is running very slowly. I think this might be something to do with the function that I feed to odesolver being poorly…
unknown
  • 853
  • 1
  • 10
  • 23
0
votes
1 answer

Iteration, and Plotting Error, PYTHON Midpoint Method, Numerical Analysis II

I'm trying to figure out why my code is not iterating the values correctly. I defined the function here: """ ================================================================= Example 4: IVP of ODE y' = -(y+1)(y+3) with intial…
0
votes
0 answers

Scilab: Failure to solve an ODE where dy/dt = A

I want to solve a differential equation of the form dy/dt = A, where A is a vector of ones. It shouldn't be a problem at all, yet it does not work. The code is: t = [1 2 3 4 5 6 7 8 9 10]; var = ones(1:length(t)); y_an = 1*t; // function yd =…
Fabio Capezzuoli
  • 599
  • 7
  • 23
0
votes
0 answers

Error in checkFunc(Func2, times, y, rho)

I am fairly new in R I am trying to plot a differential equation and further in same plot I have to do this around 4 time. I have tried following way m = sum(C[]) s= 4 #number of time curve in single plot for(i in 1:length(s)){ b = 0.1;X =…
KR12
  • 131
  • 1
  • 1
  • 8
0
votes
1 answer

Python: TypeError: 'function' object has no attribute '__getitem__'. Unable to pass an element of function to ode solver in python

After having searched couple other similar problems, I could not find a proper solution to my case. In my problem, function f returns a list and I wish to pass one element of this list to the ode solver. However when I do so, I am getting this…
Amardeep Mishra
  • 129
  • 1
  • 4
  • 16
0
votes
1 answer

Solving ode with python getting wrong solution

i want to solve the following ode KT + CT' = Q to given example Data is my code below import numpy as np import scipy as sp # Solve the following ODE # K*T + C*T' = Q # T' = C^-1 ( Q - K * T ) T_start=sp.array([ 151.26, 132.18, 131.64, 146.55,…
Search898
  • 69
  • 6
0
votes
1 answer

Matlab Use ode23 ode solver with variable

I would like to use the ode23 solver for systems. My system has three equations and the first one depends on an variable 'z' which is declared in the code above. Here´s the sample code: clc; clear; z=1; function Fv=funsys(t,Y,z);…
WinterMensch
  • 643
  • 1
  • 7
  • 17
0
votes
1 answer

error: cannot convert 'Vector (*)(double, Vector)' to 'ForwardEulerSolver*' in initialization

really struggling with this problem. I'm writing a piece of code to solve a general system of linear ODE's using the forward Euler method. I believe my code is working fine inside the classes but I'm having a problem initializing it. Here is the…
twoface
  • 51
  • 7
0
votes
1 answer

shared parameters in dynamic model with ODE

I am new in R programming and working on a dynamic model in R, but facing a problem I can not figure out now. Appreciate any help or suggestions. My data is like this: data <- data.frame(time=c(60,75,90,105,120, 135, 150,165,180,…
Kiko
  • 9
  • 3
0
votes
1 answer

Handling singularity in MATLAB

X0=linspace(-.3,.3,10); [T,X] = ode45(@difflossy,[0 10],X0); plot(T,X,'-'); function dX = difflossy(T,X) if X<-1 dX=0; else dX= X.*(1-X); end end The above is my code to solve the nonlinear differential equation. The…
Jasmine
  • 103
  • 3
1 2 3
99
100