Cody

Problem 1371. Altitude of locations on the earth

Solution 486954

Submitted on 15 Aug 2014 by Binbin Qi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% y= 27.988056; x= 86.925278; h_correct = 8815.715; assert(abs(h_correct-your_fcn_name(y,x))<1)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

2   Pass
%% y=19.823159; x=-155.470223; h_correct = 4172.297; assert(abs(h_correct-your_fcn_name(y,x))<1)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

3   Pass
%% y=40.689254; x=-74.044559; h_correct = 2.059; assert(abs(h_correct-your_fcn_name(y,x))<1)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

4   Pass
%% y=25.324167,x=-90.007325 h_correct = -3458.672; assert(abs(h_correct-your_fcn_name(y,x))<1)

y = 25.3242 x = -90.0073 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

5   Pass
%% y=11.35, x=142.2 h_correct = -10323.318; assert(abs(h_correct-your_fcn_name(y,x))<1)

y = 11.3500 x = 142.2000 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

6   Pass
%% y=50.335556; x=6.9475; h_correct = 620.046; assert(abs(h_correct-your_fcn_name(y,x))<1)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name at 6 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] ans = 1

7   Pass
%% filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'switch'))) assert(isempty(strfind(filetext, 'case'))) assert(isempty(strfind(filetext, 'if'))) assert(isempty(strfind(filetext, 'dot'))) assert(isempty(strfind(filetext, 'while')))

ans = 1 ans = 1 ans = 1 ans = 1 ans = 1

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!