adding new elements between each two elements of a vector

10 ビュー (過去 30 日間)
sarah Abdellahi
sarah Abdellahi 2019 年 4 月 8 日
編集済み: Matt J 2019 年 4 月 8 日
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

採用された回答

Matt J
Matt J 2019 年 4 月 8 日
編集済み: Matt J 2019 年 4 月 8 日
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);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by