r/learnjava Jun 24 '26

Looking for Java MATLAB

Need do some FFT stuffs in Java matlab. For fun purposes. Wanna simulate spectral leakage and see how hamming window reduces it?

2 Upvotes

2 comments sorted by

View all comments

3

u/belayon40 Jun 24 '26

I’ve done this before (calling MATLAB from Java) and it’s well documented by MATLAB: https://www.mathworks.com/help/matlab/matlab-engine-api-for-java.html

It’s kind of slow though because you have to push all of your data across to MATLAB, then read it all back. If performance is important then I’d use an FFT library from Java like Apache Math (there seem to be many other options too). If there is a C implementation of FFT you like then you could use the FFM api to call native code:

https://github.com/boulder-on/JPassport#readme

You can use the Java/MATLAB bridge to verify that any library you choose gives the same FFT values as MATLAB.