Change length of double data

7 ビュー (過去 30 日間)
Iqbal Taufik Irfanda
Iqbal Taufik Irfanda 2020 年 8 月 26 日
コメント済み: Steven Lord 2020 年 8 月 26 日
I have 803385 x 1 data double and i want to change to 7547 x 1, how to change it because the graphs are have same shape and i need to change the lenght
  3 件のコメント
Iqbal Taufik Irfanda
Iqbal Taufik Irfanda 2020 年 8 月 26 日
i want to make same shape with other length (7547), can i?
Steven Lord
Steven Lord 2020 年 8 月 26 日
Let's say you had a 12 element vector that you wanted to shrink down to a 6 element vector.
x = 1:12
There are may different ways to extract six elements out of x. Some of the possibilities:
x1 = x(1:6)
x2 = x(7:12)
x3 = x(4:9)
x4 = x(1:2:11)
x5 = x(randperm(numel(x), 6))
You can also interpolate.
x6 = interp1(1:numel(x), x, linspace(1, numel(x), 6))
How do you want to make a six element vector out of x?

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

採用された回答

KSSV
KSSV 2020 年 8 月 26 日
Read about interp1.
a = rand(803385,1) ;
N = length(a) ;
x = (1:N)' ;
%
xi = linspace(1,N,7547)' ;
ai = interp1(x,a,xi) ;

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by