增加信号中的数据点 [英] Increase data points in signal
问题描述
我的输入数据集为32
点.现在,我想通过平均点上的数据将这些32
点转换为240
点.
I have an input data set of 32
points. Now I want to convert these 32
points to 240
points by averaging the data over the points.
我想到先绘制出我拥有的32
个采样点,然后近似绘制曲线并以更高的采样频率获取数据,从而获得240
个点.
I thought of plotting the 32
sample points which I have and then by approximately plotting the curve and taking data at a higher sampling frequency so as to obtain 240
points.
我无法理解如何在MATLAB中执行此操作.我从某些来源获得帮助,但无法提出任何解决方案.该怎么办?
I am not able to understand how to do this in MATLAB. I took help from some sources, but I was not able to come up with any solution. How can this be done?
简而言之,我想通过近似信号将离散数据集的"x"个样本转换为新数据集的"y"个样本.在这里x > y
或x < y
.
In short, I want to convert 'x' samples of discrete data set to 'y' samples of new data set by approximating the signal. Here x > y
or also x < y
.
推荐答案
resample
做您想要的事情,
newdata = resample(data,240,32);
例如:
a = 1 : 32;
b = resample(a,240,32);
t = 1 : 32;
t1 = linspace(1,32,240);
plot(t,a);hold on;plot(t1,b,'r');
最后的噪声可能是由于尖锐的滤波器引起的,240/32
太高了.
The noise at the end is probably because of sharp filter, 240/32
is too high.
resample
实际上做得很好,
a = randi(10,[1 100]);
b = resample(a,240,100);
t = 1 : 100;
t1 = linspace(1,100,240);
plot(t,a);hold on;plot(t1,b,'r')
这篇关于增加信号中的数据点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!