How to compare two time signals with different amount of samples?
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have two vectors. Both vectors contain values for a time signal over 2500 ms. Vector1 has 2500 samples (1 kHz) and Vector2 has 2560 samples (1,024 kHz).
My goal is to create a diff between these two vectors in order to see the differences between the two time signals.
Is this possible? Do you have any suggestions how to achieve this?
Thank you very much in advance.
Best regards
0 Commenti
Risposte (1)
Fabio Freschi
il 7 Set 2021
Modificato: Fabio Freschi
il 7 Set 2021
Use interp1 to resample your vector(s) in order to have the same length
clear variables, close all
% time vector
t1 = 0:1/1e3:2.5;
t2 = 0:1/1024:2.5;
% dummy vectors
Vector1 = sin(10*t1);
Vector2 = sin(10*t2)+sin(100*t2);
% resample vector 1
V1 = interp1(t1,Vector1,t2);
% or resample vector 2
V2 = interp1(t2,Vector2,t1);
% plot the difference
figure, hold on
plot(t2,Vector2-V1);
plot(t1,V2-Vector1);
0 Commenti
Vedere anche
Categorie
Scopri di più su Multirate Signal Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!