how to declare

1 view (last 30 days)
Pugazhendhi
Pugazhendhi on 10 Feb 2012
Edited: Matthew Crema on 8 Oct 2013
Hi All,
I would like to declare the following code in Matlab.
r = 4/pi atan((R-G)/(R+G))
Any one please help.
Thanks,
Pugazh

Accepted Answer

William
William on 10 Feb 2012
Do you have the symbolic toolbox? If yes than
syms R G
r = 4/pi * atan((R-G)/(R+G));
else you're more than likely going to hve to define R and G in terms of domains. For example
R = 0:0.01:1;
G = 0:0.1:10; %Make sure the matrix dimensions agree.
r = 4/pi * atan((R-G)/(R+G));
Matrix manipulation is what matlab was designed to do at its basic level. the symbolic stuff is an add on that works pretty well.
  2 Comments
Walter Roberson
Walter Roberson on 10 Feb 2012
Probably you meant
r = 4/pi * atan((R-G) ./ (R+G));
Pugazhendhi
Pugazhendhi on 11 Feb 2012
Thanks, its working.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox 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!