Skip to content

Commit c65a577

Browse files
committed
updates
1 parent 7f2c8c1 commit c65a577

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

docs/src/model_creation/examples/hodgkin_huxley_equation.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,28 +172,20 @@ end
172172
```
173173
Finally, we extend the `hhmodel` with the systems defining the ion channel currents
174174
```@example hh1
175-
for sys in (IKmodel, INamodel, ILmodel)
176-
@named hhmodel2 = extend(sys, hhmodel2)
177-
end
175+
@named hhmodel2 = extend(IKmodel, hhmodel2)
176+
@named hhmodel2 = extend(INamodel, hhmodel2)
177+
@named hhmodel2 = extend(ILmodel, hhmodel2)
178178
hhmodel2 = complete(hhmodel2)
179179
```
180-
Let's again solve the system for the resting state, and then solve with the same
181-
applied current as above (to verify we get the same figure). Note, we now
182-
explicitly convert to an `ODESystem` and then run `structural_simplify` from
183-
ModelingToolkit to eliminate the algebraic equations for the ionic currents
180+
Let's again solve the system starting from the previously calculated resting
181+
state, using the same applied current as above (to verify we get the same
182+
figure). Note, we now run `structural_simplify` from ModelingToolkit to
183+
eliminate the algebraic equations for the ionic currents when constructing the
184+
`ODEProblem`:
184185

185186
```@example hh1
186-
osys = convert(ODESystem, hhmodel2)
187-
osys = structural_simplify(osys)
188-
189-
tspan = (0.0, 50.0)
190-
u₀ = symmap_to_varmap(osys, [:V => -70, :m => 0.0, :h => 0.0, :n => 0.0,
191-
:m′ => 1.0, :n′ => 1.0, :h′ => 1.0])
192-
oprob = ODEProblem(osys, u₀, tspan)
193-
hhsssol = solve(oprob, Rosenbrock23())
194-
u_ss = unknowns(osys) .=> hhsssol(tspan[2], idxs = unknowns(osys))
195187
@unpack I₀,V = hhmodel2
196-
oprob = ODEProblem(osys, u_ss, tspan, [I₀ => 10.0])
188+
oprob = ODEProblem(hhmodel2, u_ss, tspan, [I₀ => 10.0]; structural_simplify = true)
197189
sol = solve(oprob)
198190
plot(sol, idxs = V, legend = :outerright)
199191
```

0 commit comments

Comments
 (0)