Working of interpolation or decimation
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gova ReDDy
am 9 Jan. 2014
Bearbeitet: Gova ReDDy
am 16 Jan. 2014
Hello,
Can someone explain how the interpolation or decimation can be used to fit the number of samples between the two signals if both the signals doesn't have the same number of samples.
Thanks.
1 Kommentar
Akzeptierte Antwort
Image Analyst
am 9 Jan. 2014
See this demo:
% Make signal #1
t1 = linspace(-2*pi, 2*pi, 200);
period = 1.5;
y1 = sin(2*pi*t1/period);
plot(t1, y1, 'bo-', 'LineWidth', 6, 'MarkerSize', 20);
grid on;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Make signal #2
t2 = linspace(-2*pi, 2*pi, 130);
period = 1.5;
y2 = sin(2*pi*t2/period);
hold on;
plot(t2, y2, 'ys-', 'LineWidth', 4);
% Interpolate signal 2 up to have same number of samples as signal 1
y2Interp = interp1(t2, y2, t1);
plot(t1, y2Interp, 'rd-', 'LineWidth', 2);
legend('signal 1', 'signal 2', 'signal 2 interpolated');
% Now get signal half way between the signal #1
% and the interpolated signal #2
signal3 = 0.5 * y1 + 0.5 * y2Interp;
I trust you can do the case where you want to interpolate y1 down to the lesser number of samples that y2 has - it's straightforward.
6 Kommentare
Image Analyst
am 16 Jan. 2014
You're not using interp correctly - look at the first two input arguments - they are the same and they should not be.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!