Making Different Length Vector Same Length
Mostrar comentarios más antiguos
I have two sets of data, stress and strain. Strain is [9x1] and stress is [12x1]. I need both vectors to be the same length, which would be [12x1]. I have tried using the interp1 function, but in order to use this it seems as though the inputs, which would be stress and strain, have to be the same size already. I am not sure if this is even the right direction. I have provided my raw stress and strain data if someone would like to help or provide any sample code. Thank you in advance!
stress = [1.854621961
397.953227
680.5854525
1319.335498
1569.283812
2489.328323
3585.957167
4591.466307
5916.213652
7592.943924
8625.360283
9808.244251];
strain = [0.001170792
0.005019681
0.010524187
0.017380968
0.026422366
0.034377908
0.04229767
0.050683195
0.059544219
];
Respuesta aceptada
Más respuestas (2)
Jos (10584)
el 22 de Feb. de 2019
Editada: Jos (10584)
el 22 de Feb. de 2019
[EDITED] This might work for you:
ix = linspace(1, numel(stress), numel(strain))
NewStrain = interp1(ix, strain, 1:numel(stress))
2 comentarios
KH
el 22 de Feb. de 2019
Jos (10584)
el 22 de Feb. de 2019
I mixed up strain and stress ...
KH
el 22 de Feb. de 2019
0 votos
Categorías
Más información sobre Stress and Strain en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

%20-%202019%2002%2022.png)
%20-%202019%2002%2022.png)
