Hello everyone!(adsbygoogle = window.adsbygoogle || []).push({});

I'm trying hard to solve numerically a system of coupled differential equations of first order, but I get this error everytime.. I can't find the reason.. maybe you can help me, I'd really apreciate that.

This is the code:

Jg=0.000043;

Kg=0.5;

Bg=0.06;

Bpm=0.5;

r=0.11;

M=0.0000677;

N1=100;

N2=-200;

t1a=9.7;

t1d=0.2;

T1=20;

t2a=2.4;

t2d=1.9;

T2=26;

kte=0.4;

ktl=0.76;

ks=1.2;

ftc=1.5;

F0=0.7;

l0=0.2;

c=2;

kml=0.7;

kme=1;

kpm=0.32;

lmc=1.2;

lms=1.4;

Fact[x_,y_]=F0*(1-(((x-1)/0.5)^2))*((l0-y)/(l0+c*y));

Kt[z_]=(kte*z)+ktl;

Fpe[x_]=(kml/kme)*(exp ((kml*(x-lms)*(180/\[Pi]*r))-1));

S= NDSolve[{x1'[t]==x2[t],x2'[t]==(1/Jg)*(x7[t]-x8[t]-(Bg*x2[t])-(Kg*x1[t])),x3'[t]==x4[t],x4'[t]==(980/M)*(x7[t]-(x9[t]*Fact[x3[t],x4[t]])-Fpe[x3[t]]-(Bpm*(180/(N[\[Pi]]*r))*x4[t])),x5'[t]==x4[t],x6'[t]==(980/M)*(x8[t]-(x10[t]*Fact[x5[t],x6[t]])-Fpe[x5[t]]-(Bpm*(180/(N[\[Pi]]*r))*x6[t])),x7'[t]==Kt[x7[t]]*(-x2[t]-((180/(N[\[Pi]]*r))*x4[t])),x8'[t]==Kt[x8[t]]*(-x2[t]-((180/(N[\[Pi]]*r))*x6[t])),x9'[t]==(1/(t1a*(N[HeavisideTheta[t]-HeavisideTheta[t-T1]])+t1d*(N[HeavisideTheta[t-T1]])))*(N1-x9[t]),x10'[t]==(1/(t2a*(N[HeavisideTheta[t]-HeavisideTheta[t-T2]])+t2d*(N[HeavisideTheta[t-T2]])))*(N2-x10[t]),x1[0]==0,x2[0]==0,x3[0]==4,x4[0]==0,x5[0]==4,x6[0]==0,x7[0]==20,x8[0]==20,x9[0]==0.17,x10[0]==0.17},{x1[t],x2[t],x3[t],x4[t],x5[t],x6[t],x7[t],x8[t],x9[t],x10[t]},{t,0,5}]

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.`. >>

Every constant is numerically defined above.. What am I doing wrong here??

Thanks a lot!

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica Solving ODE numerically in Mathematica - I get 'ndnum' error

Tags:

Loading...

Similar Threads for Solving numerically Mathematica |
---|

MATLAB A lazy numerical solution to the diffusion equation |

Coding a numerical approximation for a damped pendulum |

MATLAB Double Numerical Integration |

Mathematica Solve Perturbation problem with mathematica |

MATLAB Solving equation with integration using MATLAB |

**Physics Forums | Science Articles, Homework Help, Discussion**