Azzera filtri
Azzera filtri

Could I change a code from jupyternote book to Matlab

1 visualizzazione (ultimi 30 giorni)
from fourier_koopman import fourier import numpy as np
x = (np.sin([2*np.pi/24*np.arange(5000)]) + np.sin([2*np.pi/33*np.arange(5000)])).T x = x.astype(np.float32)
f = fourier(num_freqs=2) f.fit(x[:3500], iterations = 1000)
  1 Commento
Joe Vinciguerra
Joe Vinciguerra il 7 Lug 2023
The short answer is "yes". But you would need to know what the python code does, how it works, and the equivalent matlab syntax. The first couple lines are simple, but that last line might give you trouble if you don't have the documentation for the "fourier_koopman" module, or know how to apply it matlab. Additionally, since it's an iterative fitting algorithm using a deep neural network, you'll likely get a different answer in Matlab. Why don't you just use python, or run the python script from matlab?

Accedi per commentare.

Risposte (1)

Neev
Neev il 11 Lug 2023
Hey Ahmed
Yes, the above code you shared can be converted to MATLAB and t=you can find the converted code below:-
% importing the libraries
import fourier_koopman.fourier;
import numpy as np;
t = 0:4999;
x = (sin(2*pi/24*t) + sin(2*pi/33*t))';
x = single(x);
f = fourier_koopman.fourier(num_freqs=2);
f.fit(x(1:3500), 'iterations', 1000);
But, before running the above code, you will have to download the fourier koopman module from the 'Add-on Explorer' in the 'Environment' section at 'Home' of MATLAB taskbar.
You can try the above and let me know oif you need any further help.
I hope the information I shared with you will be of help to you:)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by