How can I subtract vectors of different lengths?
34 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
balsip
el 27 de Jul. de 2016
Comentada: balsip
el 27 de Jul. de 2016
Hello,
I have two vectors of different lengths:
- LargerVec (length=7012)
- SmallerVec (length=7004)
The best way I've come up with to solve this to be able to subtract these vectors is to use SPILLOVER to crop off the last eight values in the larger vector:
spillover=length(LargerVec)-length(SmallerVec);
LargerVec(length(LargerVec)+1-spillover:length(LargerVec))=[];
% Gradients, lower-higher inlets
delta=LargerVec-SmallerVec;
This works, but I don't want to arbitrarily lose those last eight values from LargerVec. I would prefer to extend an average of SmallerVec.
Ultimately, I want the method that will be the most true to the data.
Thank you for your help.
5 comentarios
dpb
el 27 de Jul. de 2016
That would like be so in the spirit of "most true to the data" as it isn't doing any extrapolating which is more risky than interpolating, even.
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!