Clear Filters
Clear Filters

Numerical differentiation of a 2-D data set along one dimension

4 views (last 30 days)
I have an image with 1000 vertical pixels and 400 horizontal pixels. Now wach pixel has a certain intensity value to it. Now I want to differentiate 1000.400 (z,x) data set in vertical direction i.e. in z. Without using symbolic toolbox how do I perform this calculation numerically.

Accepted Answer

Chunru
Chunru on 18 Aug 2022
A = randn(4,5) % Your image
A = 4×5
0.5670 0.5012 2.1533 0.8796 2.5701 -0.0521 0.4847 -1.7372 -0.1244 -0.5789 -0.6350 1.9176 0.6647 -0.1368 0.9675 -1.0497 0.4211 -0.4037 -1.6222 -0.2422
[Ax, Ay] = gradient(A)
Ax = 4×5
-0.0658 0.7932 0.1892 0.2084 1.6905 0.5368 -0.8425 -0.3045 0.5792 -0.4545 2.5526 0.6499 -1.0272 0.1514 1.1043 1.4708 0.3230 -1.0216 0.0808 1.3801
Ay = 4×5
-0.6191 -0.0165 -3.8905 -1.0040 -3.1489 -0.6010 0.7082 -0.7443 -0.5082 -0.8013 -0.4988 -0.0318 0.6668 -0.7489 0.1684 -0.4148 -1.4965 -1.0684 -1.4854 -1.2096

More Answers (0)

Community Treasure Hunt

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

Start Hunting!