Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 224535

Submitted on 27 Mar 2013 by Alfonso Nieto-Castanon

Correct

14Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
m = 5.98e24/81; % Moon
y_correct = 1e-4; % m
assert(isequal(Schwarzschild_radius(m),y_correct))

                    
2
Pass
 
%%
m = 5.98e24; % Earth
y_correct = 0.0089; % m
assert(isequal(Schwarzschild_radius(m),y_correct))

                    
3
Pass
 
%%
m = 1.89813e27; % Jupiter
y_correct =  2.819; % m
assert(isequal(Schwarzschild_radius(m),y_correct))

                    
4
Pass
 
%%
m = 2e30; % Sun
y_correct =  2970.2416; % m
assert(isequal(Schwarzschild_radius(m),y_correct))