重采样信号以从信号中获取 N 个点
Resampling signal to get N amount of points from signal
我有一个信号,我想从中得到 n 个等距点。
我正在考虑使用 resample
作为执行此操作的方法,但我不确定要使用的正确值。
示例:我有一个以 8000 Hz 采样的正弦波信号,但我只想从信号中获取 4 个等距点。
fs=8000
len_of_sig=1.0; %length of signal in seconds
t=linspace(0,len_of_sig,fs*len_of_sig);
y=1*sin(1*(2*pi)*t);
spaced_points=resample(y,)
我不确定如何计算正确的值来获得 n 个等距点 (比如 4,5,6...点).
有什么想法吗?我真的不需要使用 resample
,我只是认为那是最快的。
我在 Ubuntu 64 位上使用 Octave 4.2.2。
resample
函数的文档除了重采样因子本身之外不需要任何东西:
y = resample (x, p, q, h)
Change the sample rate of x by a factor of p/q. This is performed using a polyphase algorithm. The impulse response h of the antialiasing filter is either specified or either designed with a Kaiser-windowed sinecard.
假设你有变量ndesired_samples
,它指定你最终想要多少个样本。让nsamp = fs*len_of_sig
.
重采样因子由ndesired_samples/nsamp
给出,因此p
是所需样本数,q
是总样本数。请注意 resample divides p
and q
by their GCD internally.
注意多相结构和 Kaiser 插值引起的问题 window。 IIRC 如果 p
和 q
在 GCD 之后变大(即,将 10000 个样本重采样到 8000 个样本是可以的,将 10000 个点重采样到 8001 需要进一步谨慎),则这些情况尤其糟糕。
我有一个信号,我想从中得到 n 个等距点。
我正在考虑使用 resample
作为执行此操作的方法,但我不确定要使用的正确值。
示例:我有一个以 8000 Hz 采样的正弦波信号,但我只想从信号中获取 4 个等距点。
fs=8000
len_of_sig=1.0; %length of signal in seconds
t=linspace(0,len_of_sig,fs*len_of_sig);
y=1*sin(1*(2*pi)*t);
spaced_points=resample(y,)
我不确定如何计算正确的值来获得 n 个等距点 (比如 4,5,6...点).
有什么想法吗?我真的不需要使用 resample
,我只是认为那是最快的。
我在 Ubuntu 64 位上使用 Octave 4.2.2。
resample
函数的文档除了重采样因子本身之外不需要任何东西:
y = resample (x, p, q, h)
Change the sample rate of x by a factor of p/q. This is performed using a polyphase algorithm. The impulse response h of the antialiasing filter is either specified or either designed with a Kaiser-windowed sinecard.
假设你有变量ndesired_samples
,它指定你最终想要多少个样本。让nsamp = fs*len_of_sig
.
重采样因子由ndesired_samples/nsamp
给出,因此p
是所需样本数,q
是总样本数。请注意 resample divides p
and q
by their GCD internally.
注意多相结构和 Kaiser 插值引起的问题 window。 IIRC 如果 p
和 q
在 GCD 之后变大(即,将 10000 个样本重采样到 8000 个样本是可以的,将 10000 个点重采样到 8001 需要进一步谨慎),则这些情况尤其糟糕。