comparison of vectors and reducing size
Show older comments
Greetings,
I have three vectors A , B and C of sizes 299×1 , 499×1 and 1609×1 respectively. i need code to simply reduce the size of the two large vectors (in this case B and C) to the size of the smallest vector (in this case A). how do i do that?
Accepted Answer
More Answers (1)
Ajay Kumar
on 6 Oct 2019
doc interp1
use linear interpolation, to upsample or downsample the vector to any length required
A = rand(299,1);
B = rand(499,1);
v = (1:numel(B))';
vr = (linspace(min(v), max(v), length(A)))';
newB = interp1(v, B, vr);
Hope this helps :)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!