Matrix subtraction every two adjacent column
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Stephan
2021년 2월 12일
% sample data
A = randi(10,5,3)
% second col minus first and so on
B = A(:,2:end) - A(:,1:end-1)
% first col minus second and so on
C = A(:,1:end-1) - A(:,2:end)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!