|
1 | 1 | using Plots, LaTeXStrings, Distributions |
| 2 | +using CellMLToolkit, DifferentialEquations, ModelingToolkit, SymbolicIndexingInterface |
2 | 3 |
|
3 | 4 | plotParams = (linewidth=2., dpi=300) |
4 | 5 | l = @layout [a b] |
@@ -68,23 +69,5 @@ plot(plotA, plotB, layout=l, size=(539,250), dpi=300, margin=5Plots.mm, left_mar |
68 | 69 | title=["A" "B"], titlelocation=:left) |
69 | 70 | savefig("results/diagrams/possibleProblems.pdf") |
70 | 71 |
|
71 | | -# Convergence figure |
72 | | -frequency = 790.0 |
73 | 72 |
|
74 | | -x = 0:0.0001:1 |
75 | | -y = @. 0.9*exp(-4.8x)+0.1+0.003*sin(frequency*x) |
76 | | -plot(x, y, ylim=(0,1), xlim=(0,1), legend=false, yticks=nothing, xticks=nothing, xlabel="Time", |
77 | | -ylabel="Slow Variable", left_margin=5Plots.mm; dpi=plotParams.dpi, size=(255,250), linewidth=1.25) |
78 | 73 |
|
79 | | -lens!([0.95, 1.0], [0.10, 0.125], inset = (1, bbox(0.4, 0.1, 0.5, 0.5)), xticks=nothing, |
80 | | -yticks=nothing, label="", title="Converged", titlefontcolor=:darkgreen, titlefontsize=10, |
81 | | -foreground_color_legend=nothing, framestyle=:box) |
82 | | -# Alignment on the period isn't done in the actual convergence check, but we include many more oscillations than we can show in this figure |
83 | | -period = 2*pi/frequency |
84 | | -m = minimum(y[1-2*period.<=x.<=1.0]) |
85 | | -plot!([1-2*period, 1.0], [m, m], subplot=2, color=:purple, label=" Range"; plotParams...) |
86 | | -m = maximum(y[1-2*period.<=x.<=1.0]) |
87 | | -plot!([1-2*period, 1.0], [m, m], subplot=2, color=:purple, label=""; plotParams...) |
88 | | -m = mean(y[0.95.<=x.<=0.95+2*period]) |
89 | | -plot!([0.95, 0.95+2*period], [m, m], subplot=2, color=:red, label=" Average"; plotParams...) |
90 | | -savefig("results/diagrams/convergenceDiagram.pdf") |
0 commit comments