Writing a "circle" function
이전 댓글 표시
The assignment: "write a circle that takes a scalar input r. It needs to return an output called area that is the area of a circle with radius r and a second output, cf that is the circumference of the circle. Use built-in function pi.
My answer:
function[area,cf] = circle(r)
% AREA and CIRCUMFERENCE of a circle, where r = radius of the circle.
r = rand;
cf = 2*pi*r;
area = pi*r.^2;
The "graders" response: "NOTE: the grader will only determine if your
solution for Problem 1 is correct or not. No score will be given.
Problem 1 (circle):
Testing with argument(s) 1
Feedback: Your function made an error for argument(s) 1
Your solution is _not_ correct."
I assumed r = rand was incorrect, however, now I think it means line(1).
Can anyone point me in the right direction?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!