upsamling with any number of data
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to increase my data number that is different matlab functions interp and upsampling. they add numbers after every sample but i want to add them for example two and adding sample like data=(1 3 5 7 9); data_up=(1 3 4 5 7 8 9); i wrote a code but it doesn't work for every numbers sometimes it works with odds sometimes evens can anyone give any suggestion for that?
4 Kommentare
Image Analyst
am 10 Dez. 2012
Proper indenting and adding comments to the above code would help. I'm not going to take the time to figure out badly aligned code that's uncommented with a cryptic alphabet soup of non-descriptive variable names. Perhaps someone else likes to do that though.
Akzeptierte Antwort
Wayne King
am 10 Dez. 2012
something very similar to what Image Analyst suggests is just to use a linear interpolation filter.
x = 1:2:9;
xup = upsample(x,2);
h = [1/2 1 1/2];
y = filter(h,1,xup);
In this case you do get a 1/2 in the first element of the output.
Weitere Antworten (1)
Image Analyst
am 10 Dez. 2012
Is this crazy, weird thing what you want?
data = [1, 3, 5, 7, 9]
% Want data_up = [1 3 4 5 7 8 9]
xInterpLocations = [1, 2, 2.5, 3, 4, 4.5, 5]
data_up = interp1(data, xInterpLocations)
In the command window:
data =
1 3 5 7 9
xInterpLocations =
Columns 1 through 4
1 2 2.5 3
Columns 5 through 7
4 4.5 5
data_up =
1 3 4 5 7 8 9
0 Kommentare
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!