How to Normalize the gradient matrices

18 ビュー (過去 30 日間)
bilal javed
bilal javed 2018 年 12 月 23 日
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?

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by