Horizontal First Differencer on a Matrix
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sarah Maas
am 18 Apr. 2021
Kommentiert: Sarah Maas
am 18 Apr. 2021
I have a matrix M and I need to implement a first differencer along the horizontal dimension as follows such that the value of each element is replaced by:
y[n, m] = x[n, m] − x[n, m − 1]
Where n and m be the independent variables (integer indices) indexing the matrix elements along the vertical and horizontal dimensions, respectively.
0 Kommentare
Akzeptierte Antwort
Bjorn Gustavsson
am 18 Apr. 2021
Have a look on the help and documentation to diff. For this case use:
y = diff(x,[],2);
% or explicitly 1st difference:
y = diff(x,1,2);
% or manually:
y = x(:,2:end) - y(:,1:end-1);
HTH
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!