问题
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