You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ODESystem(eqs, t, [], []; name, systems = [src, clk, model])
61
+
end
62
+
63
+
function generate_data()
64
+
dt = 4e-4
65
+
time = 0:dt:0.1
66
+
data = sin.(2 * pi * time * 100)
67
+
68
+
return DataFrame(; time, data)
69
+
end
70
+
71
+
df = generate_data() # example data
72
+
73
+
@named system = MassSpringDamperSystem(df.data, df.time)
46
74
sys = structural_simplify(system)
47
-
prob = ODEProblem(sys, [], (0, time[end]))
75
+
prob = ODEProblem(sys, [], (0, df.time[end]))
48
76
sol = solve(prob)
49
77
plot(sol)
50
78
```
51
79
52
-
## `ParametrizedInterpolationBlock` Component
80
+
## `ParametrizedInterpolation` Block
81
+
82
+
The `ModelingToolkitStandardLibrary.Blocks.ParametrizedInterpolation` component is similar to `Interpolation`, but as the name suggests, it is parametrized by the data, allowing one to change the underlying data without rebuilding the model as the data is represented via vector parameters.
83
+
The main advantage of this block over the [`Interpolation`](@ref) one is that one can use it for optimization problems. Currently, this supports forward mode AD via ForwardDiff, but due to the increased flexibility of the types in the component, this is not as fast as the `Interpolation` block,
84
+
so it is recommended to use only when the added flexibility is required.
The `ModelingToolkitStandardLibrary.Blocks.ParametrizedInterpolationBlock` component is similar to `InterpolationBlock`, but as the name suggests, it is parametrized by the data, allowing one to change the underlying data without rebuilding the model as the data is represented via vector parameters.
55
-
The `ParametrizedInterpolationBlock` is compatible with interpolation types from `DataInterpolation`.
56
90
Here is an example on how to use it
57
91
58
92
```@example parametrized_interpolation
@@ -61,29 +95,49 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
0 commit comments