Increase data points in signal

帅比萌擦擦* 提交于 2019-12-24 12:59:14

问题


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.

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.

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?

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.


回答1:


resample does what you want,

newdata = resample(data,240,32);

for example :

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');

The noise at the end is probably because of sharp filter, 240/32 is too high.

resample does great actually,

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')



来源:https://stackoverflow.com/questions/26817222/increase-data-points-in-signal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!