Gradient function of matlab
Show older comments
Can someone please explain how gradient function works? (say, how is dx1(1,2)==0.5)
>> a=[1 3 2 11 18; 7 14 9 5 10; 15 7 13 18 9; 19 12 17 7 14 ]
a =
1 3 2 11 18
7 14 9 5 10
15 7 13 18 9
19 12 17 7 14
>> [dx1 dy1]=gradient(a)
dx1 =
2.0000 0.5000 4.0000 8.0000 7.0000
7.0000 1.0000 -4.5000 0.5000 5.0000
-8.0000 -1.0000 5.5000 -2.0000 -9.0000
-7.0000 -1.0000 -2.5000 -1.5000 7.0000
dy1 =
6.0000 11.0000 7.0000 -6.0000 -8.0000
7.0000 2.0000 5.5000 3.5000 -4.5000
6.0000 -1.0000 4.0000 1.0000 2.0000
4.0000 5.0000 4.0000 -11.0000 5.0000
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!