Skip to content

Instantly share code, notes, and snippets.

View jonniedie's full-sized avatar
🛰️

Jonnie Diegelman jonniedie

🛰️
View GitHub Profile
function deep_access(sol, names...)
return map(sol.u) do u
reduce(Base.maybeview, names; init=u)
end
end
@jonniedie
jonniedie / reach_freq.ipynb
Created November 5, 2021 18:43
Reachable frequency response
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonniedie
jonniedie / reach_freq.jl
Created November 5, 2021 18:03
Reachable frequency response
### A Pluto.jl notebook ###
# v0.16.4
using Markdown
using InteractiveUtils
# ╔═╡ 15da0afe-3e5b-11ec-031f-d9903463dce1
begin
using ControlSystems
using IntervalArithmetic
@jonniedie
jonniedie / opt_orbit.jl
Last active October 14, 2021 20:40
Optimal orbit
### A Pluto.jl notebook ###
# v0.16.1
using Markdown
using InteractiveUtils
# ╔═╡ b2663d22-8605-11eb-17fa-e90e625ac922
using ComponentArrays
# ╔═╡ 932b2cb6-8609-11eb-27d7-a393d81f6d8a
using ComponentArrays, DifferentialEquations, Plots, UnPack
## Functions
function lotka!(D, x, p, t)
@unpack NB, NR = x
@unpack ϵ₁, ϵ₂, γ₁, γ₂ = p
D.NB = ϵ₁*NB - γ₁*NR*NB
D.NR = -ϵ₂*NR + γ₂*NR*NB
@jonniedie
jonniedie / mtk_optimal_control.jl
Last active March 15, 2021 16:23
Optimal Control
using DifferentialEquations
using ModelingToolkit
# Time and time derivative
@parameters t
D = Differential(t)
# Forced Duffing oscillator
function Duffing(; name)
@parameters α β
@jonniedie
jonniedie / DiffEqFlux_example.jl
Last active July 1, 2020 20:21
NeuralODE example using DiffEqFlux and ComponentArrays
## This example comes from https://diffeqflux.sciml.ai/dev/Flux/
using ComponentArrays
using OrdinaryDiffEq
using Plots
using UnPack
using DiffEqFlux: sciml_train
using Flux: glorot_uniform, ADAM, σ, relu
using Optim: LBFGS