How to Normalize the gradient matrices

5 views (last 30 days)
bilal javed
bilal javed on 23 Dec 2018
I have a matrix F and initial[x1 y1] and final position[x2 y2]. I have to update the position [x y] using gradient of matrix F to get the desired position. My approach is like this:
[grad_x grad_y] = gradient(F);
[x_new y_new] = [x1 y1]+(step_size)*[grad_x(y1,x1), grad_y(y1,x1)];
I am taking step size 1. but when I tries to normalize the gradient matrices [grad_x grad_y] using formula norm_grad_x = grad_x/norm(grad_x), the values becomes very small and it is hard to update the position on every iteration. [x_new y_new] = [x1 y1]+(step_size)*[norm_grad_x(y1,x1), norm_grad_y(y1,x1)];
Can someone please guide me where I am having a mistake?

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!