I try to estimate an expression of y=sin(w+x) where I need to have a parameter of w. It gives an error during solve step. I know it is related to the parameter w but has no clue how to debug.
I saw examples with differential equations but not with a simple “DirectDataDrivenProblem”.
Here is my code:
using DataDrivenDiffEq
using ModelingToolkit
using DataDrivenSparse
X = rand(1,100)
Y = rand(1,100)
problem = DirectDataDrivenProblem(X, Y)
@variables u[1:1]
@parameters w[1:1]
basis = Basis([sin.(u[1]+w[1]);], u, parameters=w)
println(basis)
res = solve(problem, basis, STLSQ())
BoundsError: attempt to access 0-element view(::Vector{Float64}, :) with eltype Float64 at index [1]
Thanks for help!