Java中的信号处理库? [英] Signal processing library in Java?

查看:670
本文介绍了Java中的信号处理库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算时间序列的功率谱密度;做一些带通,低通和高通滤波;也许还有一些基本的东西。

I'd like to compute power spectral density of time series; do some bandpass, lowpass, and highpass filtering; maybe some other basic stuff.

有没有一个很好的开源Java库来做这个?

Is there a nice open-source Java library to do this?

I有点没有成功地搜索(例如,谷歌搜索功率谱密度java或信号处理java和点击链接,查看Apache Commons,Sourceforge,java.net等)。

I've hunted a bit without success (e.g., Googling "power spectral density java" or "signal processing java" and clicking through links, looking in Apache Commons, Sourceforge, java.net, etc.).

有许多小程序,书籍,教程,商业产品等,不符合我的需求。

There are lots of applets, books, tutorials, commercial products, etc., that don't meet my needs.

更新 :我找到了 org。用于傅里叶变换的apache.commons.math.transform 。这没有实现功率谱密度,带通等,但它是一些东西。

Update: I found org.apache.commons.math.transform for Fourier transforms. This doesn't implement power spectral density, bandpass, etc., but it is something.

推荐答案

我的第一个建议是不是用Java做你的DSP实现。我的第二个建议是用Java自己编写简单的DSP实现。

为什么不使用Java:

我在过去10多年里有很多编写DSP代码的经验......几乎没有任何DSP代码在Java ...当我犹豫是否想要在Java中实现DSP的人时,请原谅我。

I have lots of experience writing DSP code over the last 10+ years... and almost none of the DSP code is in Java... so forgive me when I am hesitant to read about someone who wants to implement DSP in Java.

如果你要做非琐碎的DSP 然后你不应该使用Java。在Java中实现DSP是如此痛苦的原因是因为所有优秀的DSP实现都使用低级内存管理技巧,指针(指针数量疯狂),大型原始数据数组等。

If you are going to be doing non-trivial DSP then you shouldn't be using Java. The reason that DSP is so painful to implement in Java is because all the good DSP implementations use low level memory management tricks, pointers (crazy amounts of pointers), large raw data arrays, etc.

为什么要使用Java:

如果你正在做简单的DSP 那么滚动你自己的Java实现。像PSD和过滤这样的简单DSP事件都相对容易实现(易于实现,但它们不会很快),因为有太多的实现示例和在线记录的理论。

If you are doing simple DSP stuff roll your own Java implementation. Simple DSP things like PSD and filtering are both relatively easy to implement (easy implementation but they won't be fast) because there is soo many implementation examples and well documented theory online.

在我的情况下,我在Java中实现了一个PSD函数,因为我在Java GUI中绘制PSD图形,因此最简单的方法是在Java中获得性能并且PSD在java GUI中计算然后绘制它。

In my case I implemented a PSD function in Java once because I was graphing the PSD in a Java GUI so it was easiest to just take the performance hit in Java and have the PSD computed in the java GUI and then plot it.

如何实现PSD:

PSD通常只是以dB为单位显示的FFT幅度。学术,商业和开源中有很多例子说明如何以dB为单位计算FFT的幅度。例如, Apache有一个Java实现,可以为您提供FFT 输出然后你只需要转换为幅度和dB。 FFT之后的任何内容都应根据您的需要量身定制。

The PSD is usually just the magnitude of the FFT displayed in dB. There are many examples from academic, commercial and open-source showing how to compute the magnitude of the FFT in dB. For example Apache has a Java implementation that gives you the FFT output and then you just need to convert to magnitude and dB. Anything after the FFT should be tailored to what you need/want.

如何实现低通带通滤波:

How to implement lowpass, bandpass filtering:

在我看来,最简单的实现(不是计算效率最高)将使用FIR滤波器并进行时域卷积。

The easiest implementation (not the most computationally efficient) would in my opinion be using an FIR filter and doing time domain convolution.

卷积非常容易实现它是两个嵌套for循环,网上有数百万个示例代码。

Convolution is very easy to implement it is two nested for loops and there are literally millions of example code on the net.

如果您对滤波器设计一无所知,FIR滤波器将是棘手的部分。最简单的方法是使用Matlab生成FIR滤波器,然后将系数复制到java中。我建议使用Matlab中的firpmord()和firpm()。在阻带中发射-30至-50 dB衰减,在通带内发射3 dB纹波。

The FIR filter will be the tricky part if you don't know anything about filter design. The easiest method would be to use Matlab to generate your FIR filter and then copy the coefficents into java. I suggest using firpmord() and firpm() from Matlab. Shoot for -30 to -50 dB attenuation in the stopband and 3 dB ripple in the passband.

这篇关于Java中的信号处理库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆