ode

Population values not updating in deSolve in R

心不动则不痛 提交于 2020-01-15 08:05:45
问题 I am working on a model with different compartments for different age groups and smokers/non-smokers. I thought all was going well, but when I started to dig into the output, I see that the populations are not updating at each time step as I anticipated. I used the debugger to step through the code, and indeed, it keeps using the initial stock size for every time step, so I end up with a constant change in population sizes, which is incorrect. There are 200 stocks in the model, so I don't

Population values not updating in deSolve in R

♀尐吖头ヾ 提交于 2020-01-15 08:05:28
问题 I am working on a model with different compartments for different age groups and smokers/non-smokers. I thought all was going well, but when I started to dig into the output, I see that the populations are not updating at each time step as I anticipated. I used the debugger to step through the code, and indeed, it keeps using the initial stock size for every time step, so I end up with a constant change in population sizes, which is incorrect. There are 200 stocks in the model, so I don't

Population values not updating in deSolve in R

自作多情 提交于 2020-01-15 08:05:09
问题 I am working on a model with different compartments for different age groups and smokers/non-smokers. I thought all was going well, but when I started to dig into the output, I see that the populations are not updating at each time step as I anticipated. I used the debugger to step through the code, and indeed, it keeps using the initial stock size for every time step, so I end up with a constant change in population sizes, which is incorrect. There are 200 stocks in the model, so I don't

Solving ODE in Scilab

社会主义新天地 提交于 2020-01-15 06:24:00
问题 I am trying to do some electric circuit analysis in Scilab by solving an ODE . But I need to change an ODE depending on current value of the function. I have implemented the solution in Scala using RK4 method and it works perfectly. Now I am trying to do the same but using standard functions in Scilab . And it is not working. I have tried to solve these two ODEs seperately and it is OK. clear state = 0 // state 0 is charging, 1 is discharging vb = 300.0; vt = 500.0; r = 100.0; rd = 10.0; vcc

Solving ODE in Scilab

感情迁移 提交于 2020-01-15 06:23:04
问题 I am trying to do some electric circuit analysis in Scilab by solving an ODE . But I need to change an ODE depending on current value of the function. I have implemented the solution in Scala using RK4 method and it works perfectly. Now I am trying to do the same but using standard functions in Scilab . And it is not working. I have tried to solve these two ODEs seperately and it is OK. clear state = 0 // state 0 is charging, 1 is discharging vb = 300.0; vt = 500.0; r = 100.0; rd = 10.0; vcc

How to simulate bouncing ball? odeint not applicable?

北城余情 提交于 2020-01-14 05:50:12
问题 Here is a code simulating the simplest falling ball: %pylab from scipy.integrate import odeint ts = linspace(0, 1) def f(X, t): dx0 = X[1] dx1 = -9.8 return [dx0, dx1] X = odeint(f, [2, 0], ts) plot(ts, X[:, 0]) But how about a ball bouncing at y=0? I know that, in general, collision is a difficult part of physics simulations. However, I wonder if it's really not possible to simulate this simple system, hopefully with odeint. 回答1: The simplest way is just to add a big force that kicks the

How to solve DAE with a varying input / a time-dependent input function in Matlab?

瘦欲@ 提交于 2020-01-13 14:50:38
问题 I'm solving a DAE problem with ode15i solver. I have 8 variables and 8 equations, and the system is complex that the only working solver so far is ode15i. I've used the guide: http://se.mathworks.com/help/symbolic/set-up-your-dae-problem.html. However, this guide doesn't help me to solve the problem with a varying input. My system has a time-dependent input, a function. The function itself is quite simple, but the problem is that the time t in DAE system is in symbolic form, and my input

BVP4c solve for unknown boundary

ぐ巨炮叔叔 提交于 2020-01-07 04:20:14
问题 I am trying to use bvp4c to solve a system of 4 odes. The issue is that one of the boundaries is unknown. Can bvp4c handle this? In my code L is the unknown I am solving for. I get an error message printed below. function mat4bvp L = 8; solinit = bvpinit(linspace(0,L,100),@mat4init); sol = bvp4c(@mat4ode,@mat4bc,solinit); sint = linspace(0,L); Sxint = deval(sol,sint); end % ------------------------------------------------------------ function dtdpdxdy = mat4ode(s,y,L) Lambda = 0.3536;

How do I access and print the complete vector distributed among MPI workers?

廉价感情. 提交于 2020-01-06 19:37:39
问题 How do I access a global vector from an individual thread in MPI? I'm using a library - specifically, an ODE solver library - called CVODE (part of SUNDIALS). The library works with MPI, so that multiple threads are running in parallel. They are all running the same code. Each thread sends the thread "next to" it a piece of data. But I want one of the threads (rank=0) to print out the state of the data at some points. The library includes functions so that each thread can access their own

Solving a system of ODEs where the functions are given discrete (matlab)

北慕城南 提交于 2020-01-06 14:43:26
问题 My question this time is base on an old question I have asked for some months ago (see HERE) If you don't want to go through my first question I can give a short overview about that problem. In my first question I had two vectors, the first one fx containing function values : fx = [0.5644 0.6473 0.7258 0.7999 0.8697 0.9353 0.9967 1.0540 1.1072 1.1564 ... 1.2016 1.2429 1.2803 1.3138 1.3435 1.3695 1.3917 1.4102 1.4250 1.4362 ... 1.4438 1.4477 1.4482 1.4450 1.4384 1.4283 1.4147 1.3977 1.3773 1