Expanding Matrix with Integers (between decimal numbers)

1 回表示 (過去 30 日間)
Orkun OZENER
Orkun OZENER 2017 年 9 月 21 日
コメント済み: Orkun OZENER 2017 年 9 月 21 日
Hi I have two vector one is time the other one is velocity. Because of GPS logging freq.I am having decimal numbers. Also when the car stops the gps stop logging. So I want to add integers to time matrix, and will ad corresponding interpreted velocities to the velocity matrix.
Like:
T=[ 39.01; 41 ;43.13;45; 47.02] V=[19.47;9;11.84;13.35;11.70]
So I should have the new T
T_new=[ 39.01; 40; 41 ; 42;43.13; 44;45; 46; 47.02]
V_new=[ 19.47; interp_new_val;9; interp_new_val,11.84; interp_new_val;13.35; interp_new_val;11.70]
And the nest one after this,
How can I form for example 5hz time-veloicty data from this data? Starting from zero.
Kind Regards

採用された回答

Guillaume
Guillaume 2017 年 9 月 21 日
編集済み: Guillaume 2017 年 9 月 21 日
"But how to create T_new?"
An option:
T_integer = round(T);
T_new = union(setdiff(min(T_integer):max(T_integer), T_integer), T)
  1 件のコメント
Orkun OZENER
Orkun OZENER 2017 年 9 月 21 日
Thank you very much...These two function i really new for me..I spent 10 minutes for undertstanding...But it really works..GREAT..
Lastly.....If the time difference of original matrix is ie. more than 4 second...the veloicty should be zero... The GPS is stopping... Actually ..enlarging and if conditional at the same time I am really mixed..and exhausting..:)

サインインしてコメントする。

その他の回答 (1 件)

Jos (10584)
Jos (10584) 2017 年 9 月 21 日
Almost there, use the function interp1:
T = [ 39.01; 41 ;43.13;45; 47.02]
V = [19.47;9;11.84;13.35;11.70]
T_new=[ 39.01; 40; 41 ; 42;43.13; 44;45; 46; 47.02]
V_new = interp1(T, V, T_new)
  1 件のコメント
Orkun OZENER
Orkun OZENER 2017 年 9 月 21 日
Thankx,
But how to create T_new?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultirate and Multistage Filters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by