Borrar filtros
Borrar filtros

adding new elements between each two elements of a vector

9 visualizaciones (últimos 30 días)
sarah Abdellahi
sarah Abdellahi el 8 de Abr. de 2019
Editada: Matt J el 8 de Abr. de 2019
Experts,
I have a an array as follows:
T =
985 926 692 749
915 825 662 760
931 810 668 764
761 676 736 754
733 657 720 693
757 622 699 756
677 718 557 758
703 737 696 743
769 693 708 693
814 728 562 677
895 719 611 713
805 652 534 783
833 694 580 749
I want to linearly interpolate N points between each two elements of the array and add the new values in between. For example if N=3, T(1:5,1)= linspace(985, 915, 5), and same for the rest of the elements.
I would appreciate if someone can help me doing this, avoding for loop! maybe?
Thanks

Respuesta aceptada

Matt J
Matt J el 8 de Abr. de 2019
Editada: Matt J el 8 de Abr. de 2019
I can't tell if you mean to interpolate only between rows or between columns as well. If the former, then try this,
t=1:size(T,1);
q=linspace(t(1), t(end), (N+1)*(t(end)-1)+1);
Tnew=interp1(t,T,q);

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by