Questions tagged [differential-equations]

An equation that relates some unknown function itself and its derivatives of various orders.

An equation that relates some unknown function itself and its derivatives of various orders, for instance x'' = g (free fall) or x' = v (movement under constant speed). Developers solve differential equations numerically or write symbolic engines to solve analytically.

1488 questions
-1
votes
1 answer

What is the mistake in this C implementation of Fitzhugh-Nagumo model?

I have implemented a MATLAB code for Fitzhugh-Nagumo model and got the plots, but when I translated it to C code like below, its not giving me proper output. Specifically neurons are not spiking. Can any one point out the mistake? #include…
dexterdev
  • 537
  • 4
  • 22
-1
votes
1 answer

How to simulate pendulum movement with high amplitude in C#

I need to make a C# simulator for a simple pendulum. I have been searching the web for 3 days and I am stuck. The problem is I have found many equations that would give the angle position as a function of time, which is perfect for my needs for…
-1
votes
1 answer

How can I solve this third order equation using the ODE45 function?

When I convert the third order ODE into a system of first order ODEs, I got this: x1' = x2; x2' = x3; x3' = R1*x1+R2*x2-alpha*x3; x4' = 1; where x4 = t; R1 = -0.000001*(1-cos(theta*x4))-theta*sin(theta*x4)+1; R2 = -(1-cos(theta*x4));
Leandro
  • 3
  • 2
-1
votes
1 answer

How to solve a system of differential equations?

For a homework assignment, my professor asked us to solve a system of differential equations using MATLAB. Using the mathworks website, I did syms f(t) g(t) h(t) [f(t), g(t), h(t)] = dsolve(diff(f) == .25*g*h,... diff(g) == -2/3*f*h,... diff(h) ==…
-1
votes
1 answer

how to assing coefficients both positive and real using dsolve

so i want to solve these equation FullSimplify[DSolve[{iL''[t] + iL[t]/(C*L) == Vc[t]/(C*L*R), C*Vc''[t] + Vc'[t]/R + Vc[t]/L == Vin/L}, {iL[t], Vc[t]},t] {{C, L, R} \[Element] Reals && C >= 0 && L >= 0 && R >= 0}] symbolically and i want to…
-1
votes
1 answer

Matlab ODE - Simulink integrator with sum block in m-file without simulink?

Is it possible to do something like this ---- ------- --->|+ |------->| 1/s |-----o---------> | -| | | | ---- ------- | /|\ | -------------------- in a matlab ode…
cico
  • 23
  • 3
-1
votes
2 answers

Continuous plot of ODE function

I have a ODE solver works nice and smooth, but I need to plot all in one figure. Connect figure (1)+(3) and Figure (2)+(4), I have to set start and stop conditions, but it not work for me, I´m at a dead end. I´m trying set the end conditions by x_m…
user2401142
  • 9
  • 1
  • 4
-1
votes
1 answer

integrating orbital trajectories 2

The original second order ODEs are x'' - 2 * omega * y' - omega ** 2 * x = - mue * (x + pi2 * r12) / np.sqrt((x + pi2 * r12) ** 2 + y ** 2) ** 3 - mum * (x - pi1 * r12) / np.sqrt((x - pi1 * r12) ** 2 + y ** 2) y'' + 2 * omega * x' - omega **2 * y =…
dustin
  • 4,309
  • 12
  • 57
  • 79
-1
votes
1 answer

Implementing explicit Euler method (for ODEs) in MATLAB

I've searched everywhere, and I can't find anything. First of all, let me just say I have never used Mat Lab so I have no idea what I am doing what so ever. I have tried a few things, but none have worked. Apparently y(0)=2 tries to create a list…
Tropical_Peach
  • 1,143
  • 3
  • 16
  • 29
-2
votes
1 answer

Error tolerance not working in C++, when plotted against ODE45 in MATLAB

I am comparing the ODE solver of C++ (BOOST ODEINT) against MATLAB's ODE45. Each set of code has the same equations and initial conditions. When error tolerance is added to the C++ code, the difference between the two values (C++ and MATLAB) is…
Jon Snow
  • 1
  • 1
-2
votes
1 answer

solve_ivp with differential equations that can't be expressed as their derivatives

I wish to solve the system y' = y + u' u' = y' + u and it looks as if solve_ivp requires that I solve for the derivative and express it in terms of the original functions, but I'm not sure how to do that in this case. I don't want a way to find the…
-2
votes
1 answer

How can I solve this system of differential equations numerically on Python?

I wanted to solve this system of differential equations using Python, and I was wondering how to do it. I've tried nothing yet since I'm new to these systems, though I have already solved some individual diff. eqs.. Right now, I'm familiar with…
JoanSGF
  • 101
  • 1
-2
votes
1 answer

Finite Difference Solution to Heat Equation

Practicing finite difference implementation and I cannot figure out why my solution looks so strange. Code taken from: http://people.bu.edu/andasari/courses/numericalpython/Week9Lecture15/PythonFiles/FTCS_DirichletBCs.py. Note: I'm using this…
-2
votes
1 answer

An array with real subscripted variable

I have problem using the results of a subroutine in the main program. I wrote this code: Program RK4 implicit none real k1,k2,k3,k4,h,t,R integer i,n real a read*,n,h t=0 R=0 Do i=1,n call Scale_Factor(h,n,t,a) k1=h*(1/a(t)) …
-2
votes
1 answer

Solving 1st order differential equations for matrices

I'd like to code in python a coupled system of differential equations : dF/dt=A(F) where F is a matrix and A(F) is a function of the matrix F. When F and A(F) are vectors the equation is solved using scipy.integrate.odeint. However,…
J.A
  • 285
  • 3
  • 12