Azzera filtri
Azzera filtri

how to down sample a vector?

37 visualizzazioni (ultimi 30 giorni)
fariba amini
fariba amini il 12 Apr 2016
Commentato: Max Murphy il 10 Set 2017
I have a vector which contain 60 elements. I want to down sample it to have 54 elements.how can I do this?
  1 Commento
Max Murphy
Max Murphy il 10 Set 2017
I am going to try using downsample: https://au.mathworks.com/help/signal/ref/downsample.html

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 12 Apr 2016
There are several ways, depending on what your vector is.
This approach is likely the simplest, and used interp1:
V = randi(99, 1, 60); % Vector
idx = 1:60; % Index
idxq = linspace(min(idx), max(idx), 54); % Interpolation Vector
Vi = interp1(idx, V, idxq, 'linear'); % Downsampled Vector
figure(1)
plot(idx, V, '-r')
hold on
plot(idxq, Vi, 'bp')
hold off
grid
legend('Original Vector', 'Downsampled Vector')

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by