Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a significant divergence between the model based on experimental data and the analytical solution #525

Open
Marcel0436 opened this issue Jun 25, 2024 · 1 comment

Comments

@Marcel0436
Copy link

Hi.

I am modeling an RLC circuit for alternating current (AC) using a data-driven approach. I use the variables current (i), charge (q), and frequency (f). The model is diverging from the analytical solution. Could someone please help me?"

My code:

poly_order = 0
poly_library = ps.PolynomialLibrary(degree=poly_order,  interaction_only=True)
fourier_library = ps.FourierLibrary(include_cos=False)
combined_library = poly_library + fourier_library

feature_names = ['i', 'q', 'f']


ensemble_optimizer = ps.EnsembleOptimizer(
    ps.STLSQ(normalize_columns=True),
    bagging=True,
    n_subset=int(0.6* x_train.shape[0])
)

model = ps.SINDy(feature_names=feature_names,differentiation_method=ps.FiniteDifference(drop_endpoints=True),optimizer=ensemble_optimizer,feature_library = combined_library)
model.fit(x_train, t0, ensemble = True,
    n_models = 20,replace=True, quiet=True)
model.print()

My results:

(i)' = -41.144 1 + 436.417 sin(1 i) + -18908612133.648 sin(1 q) + -14.919 sin(1 f)
(q)' = 0.997 sin(1 i)
(f)' = 21.980 1

The term (f)' is correct. For (q)', it is somewhat accurate, It is necessary to remove sin(i) because, for my solution (q)' = i.
However, (i)' is problematic. The term -18908612133.648 sin(1 q) is very large because according to the analytical solution, this is term should be i*sin(1 q).

I have tried several approaches to solve this issue, but so far I haven't found an effective solution.
output

@Jacob-Stevens-Haas
Copy link
Collaborator

  1. (q)'=sin (1 i) is very close to (q)' = i if i is close to zero, which it appears to be in your plot.
  2. i*sin(1 q) would come out of a TensoredLibrary. Your addition combined_library = poly_library + fourier_library provides a ConcatLibrary. See these lines of source code.
  3. Nevertheless 18908612133.648 sin(1 q) is nowhere close to i sin(1 q) on the scale of the plot, where i is $\mathcal O(1e-2)$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants