discrete second order derivative operator for unequally spaced data

조회 수: 8 (최근 30일)
David Kusnirak
David Kusnirak 2013년 2월 14일
Hi,
I need help to obtain a discrete second order derivative operator, that could be applied on a matrix. The best way, I guess, is to reshape the matrix into vector form and create a diagonal matrix with the operator, which is easy for equally spaced data in the matrix,but how can I incorporate the distances (width and heigth of the cells) for unequally spaced data?
Thanks
  댓글 수: 2
Matt J
Matt J 2013년 2월 14일
I don't see how a diagonal matrix could ever give you a derivative operator, even with equally spaced data. A diagonal matrix can only weight each element of the operand independently, not take differences between them. Please describe the organization of your data more clearly. Does each column of your matrix contain signal samples to be differentiated? Is the spacing between these samples the same for all columns?
David Kusnirak
David Kusnirak 2013년 2월 15일
sorry, I wrote it unclear, I meant diagonal matrix with 4 off-diagonals.
example:
if ma data matrix is
M = magic(3)
and the width and height of each cell is 1, the operator looks like:
L=[ -4 1 0 0 1 0 0 0 0;
1 -4 1 0 0 1 0 0 0;
0 1 -4 1 0 0 1 0 0;
0 0 1 -4 1 0 0 1 0;
1 0 0 1 -4 1 0 0 1;
0 1 0 0 1 -4 1 0 0;
0 0 1 0 0 1 -4 1 0;
0 0 0 1 0 0 1 -4 1;
0 0 0 0 1 0 0 1 -4];
so the product of the operator (in vector form) is
dz = L * reshape(m,1,[]);
and back to matrix
dz = reshape(dz,3,3)
My question is how to implement proper geometry of the cells, for example width = 2*heigth

댓글을 달려면 로그인하십시오.

답변 (4개)

Teja Muppirala
Teja Muppirala 2013년 2월 15일
Could you possibly use the GRADIENT command? This allows you to pass in unevenly spaced values for X and Y.
help gradient
  댓글 수: 3
Teja Muppirala
Teja Muppirala 2013년 2월 15일
I though he meant a first derivative (to second order accuracy), so just calling GRADIENT once.

댓글을 달려면 로그인하십시오.


Youssef  Khmou
Youssef Khmou 2013년 2월 15일
Discrete Laplacian :
del2(matrix)
Example :
[x,y]=meshgrid(-4:.1:4);
z=exp(-x.^2-y.^2);
dz2=del2(z);

Jan
Jan 2013년 2월 15일
A fast gradient with 2nd order method for unevenly distributed data: FEX: DGradient.

David Kusnirak
David Kusnirak 2013년 2월 15일
Thanks for hints. However I'm not as interested in the solution as in the operator itself, I need to know how does it look and work.
thanks for any help

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by