フィルターのクリア

Could I change a code from jupyternote book to Matlab

1 回表示 (過去 30 日間)
Ahmed Gharieb naga
Ahmed Gharieb naga 2023 年 7 月 7 日
回答済み: Neev 2023 年 7 月 11 日
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 件のコメント
Joe Vinciguerra
Joe Vinciguerra 2023 年 7 月 7 日
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?

サインインしてコメントする。

回答 (1 件)

Neev
Neev 2023 年 7 月 11 日
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:)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by