MATLAB Answers

convert formula into coding form

2 views (last 30 days)
Syakira Akmal
Syakira Akmal on 11 Apr 2017
Commented: PPO POT on 11 Sep 2019
Hi, i have this kind of formula
dy=(X,Y+1)-(X,Y-1)
dx=(X+1,Y)-(X-1,Y)
(X,Y)=(dx^2+dy^2)^1/2
and i want to convert into coding form.Can anyone help me? and I just get confuse whether the formula need to be to a second derivation or just power of 2 the value?
  2 Comments
Rik
Rik on 11 Apr 2017
What do you actually mean with this syntax? (And I would advise using sqrt instead of ^(1/2).)

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 11 Apr 2017
Use imgradient():
[Gx, Gy] = imgradientxy(I); % Gx is what you call dx and Gy is what you call dy.
[Gmag, Gdir] = imgradient(Gx, Gy); % Gmag is what you call alpha.
  3 Comments
PPO POT
PPO POT on 11 Sep 2019
Dear Munshida P ,
Please give me your original paper that give the equation of AG= 1/((H−1) (W−1))xyG (x, y)√2 to me.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by