实时绘制光谱? [英] Plot Spectrum in real time?
问题描述
我想在Qwt Oscillocope的例子中添加和绘制信号的频谱。我的想法是创建另一个seriesData类。
SerieData。我不知道是否会在SeriesData的样本和Signaldata的样本之间不会有冲突,或者我只需要修改signaldata?
任何帮助和建议将不胜感激。感谢
输入信号通常采用循环缓冲的形式
<输出缓冲区可以是静态的
- 这也适用于时域图
这是我如何做的:
-
为FFT执行一些缓冲区(数组)
- static ...
- 不会发生任何更改
- 它的大小必须至少
slowest_timebase / fsampling
samples
- 如果您想要滚动/缩放/取消缩放,则您的FFT具有复杂的域输入,然后加倍大小
-
- 通过触发器
- 或仅用于最后N个样本的启动器(但由于相位...会闪烁)
- ,或者您以N-sampe块从开始到结束以与采样相同的速度预览所有样本
- 类似于将数据发送到声卡播放声音
过程数据 - 将数据从起始点复制到FFT缓冲区
- 如果需要,添加样本的虚部(Im = 0.0)
- 处理FFT
- 绘制实际输出的前半部分
- max频率为fsampling / 2
- 您也可以将对数轴添加到频率
- 在这种情况下不要忘记更改绘图中的x值
-
更新开始位置
- 不要忘记触发器还会使用此时间作为起始点,然后才能找到真正的开始...
I would like to add and plot the spectrum of signal on Qwt Oscillocope's example. My Idea is to create another seriesData class. SerieData. I wonder if there will not conflict between sample of SeriesData and sample of Signaldata or I just need to modify the signaldata? Any help and Advice would be appreciated. Thanks
input signal is usually in form of cyclic buffer
output buffer can be static one
- this applies also for time domain plot
- without actually see your structures is impossible to answer if you had to change them or not
Here is how I do this:
make some buffer (array) for FFT
- can be static ...
- no changes in it will happen
- it size has to be at least
slowest_timebase/fsampling
samples - in case your FFT has complex domain input then double the size
- if you want to scroll/zoom/unzoom then enlarge the size accordingly
find the start sample of the actual Oscilloscope view
- via trigger
- or for starters just last N-samples (but it will flicker because of phase ...)
- or you preview all samples by N-sampe chunks from start to end with the same speed as sampling
- similar like you would send data to soundcard to play sound
- you just start after some time so you have enough sampled data already ...
process data
- copy data from start point to FFT buffer
- add imaginary part of samples if needed (Im=0.0)
- process FFT
- plot the first half of real output f it
- max frequency is fsampling/2
- you can also add logarithmic axises to frequency
- in that case do not forget to change the x value in plot too
update start position
- simply add to start position the size of used samples (N)
- do not forget that trigger also use this time as start point before finding the real start...
这篇关于实时绘制光谱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!