the area of a circle is defined by:
A = (pi)*(r^2)
--> for d = 2 like in your test suite that means:
r = d/2 --> r=1
--> r^2 = 1
--> multplied by pi = 1*pi
so A(d=2) = A(d/2) = A(r) = r^2 * pi = 1^2 * pi = 1 * pi = pi
not 4*pi like your solution suggests.
Your solution would be correct for R=2 - not D=2 - you should correct this. Ether you change the description that the diameter is given (should be radius to be correct) or you change the Test suite inm order to give correct results.
The Hitchhiker's Guide to MATLAB
Given area find sides
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
Maximum value in a matrix
Finding fourier transform of a given vector
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office