Matrix subtraction every two adjacent column
古いコメントを表示
Hello everyone,I have a matrix x with MxN = (3750X666) and I want to subtract every two adjacent column,normalize it and create a new matrix y= [x(:,n)-x(:,1:n-1))] ./ x(;,n), n start with 2nd column and end with N, how can I do it?
4 件のコメント
Matt J
2021 年 2 月 12 日
We covered this, I believe, in your almost identical question here,
MUHAMMAD SYAKIR YUSRI
2021 年 2 月 12 日
編集済み: MUHAMMAD SYAKIR YUSRI
2021 年 2 月 12 日
Here is the solution you were given. As you can see, it does 664 subtractions, which is exactly the number of pairs available (separated by a stride of 2) along the whole width of your matrix.
x=rand(3750,666);
y=(x(:,3:end)-x(:,1:end-2))./x(:,2:end-1);
whos y
MUHAMMAD SYAKIR YUSRI
2021 年 2 月 12 日
回答 (2 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!