Meaning of the code cx, cy

10 views (last 30 days)
Ricardo G
Ricardo G on 3 Oct 2019
Commented: Ricardo G on 4 Oct 2019
What does the code [cx, cy] mean/specifies when plotting a 2D circle? Where can I the definitions for such items on the MATLAB website or manuals? Thanks.
  4 Comments
Steven Lord
Steven Lord on 3 Oct 2019
I agree with both of Adam's statements. The author of that example could have used many different identifiers for the output arguments of that function call:
% Animals
[aardvark, zebra] = circlefn(2.5);
% Randomly pressing keys
[giodfj, fojjfo] = circlefn(2.5);
% Indicate a lot of information about the code's origin
[lesson5_example_first_output, ...
lesson5_example_second_output] = circlefn(2.5);
But generally speaking, the more descriptive the name of the output argument the easier I find it to understand the code (within reason; no need to write a book when a word would do!)
cx and cy as the coordinates of the points on a circle seem reasonable, though if space on the page weren't an issue I might have used something slightly longer and more descriptive to disambiguate between the coordinates of the center of the circle and the coordinates of the points on the circle (both of which could reasonably be called cx and cy.)
[Xpoints, Ypoints] = circlefn(2.5);
Ricardo G
Ricardo G on 4 Oct 2019
Hi, Steven Lord,
Thank you. I believe you just made that section/lesson of the book I'm using clearer; and, further, the rest of the book! Now, I will not be as concern as to WHY the author assigned a variable/function a particular name ( as you said, he can have named them anything: aardvark, zebra).
Regards,
Ricardo

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!