Cody

Problem 8046. Gold/Silver Standard

Solution 675639

Submitted on 26 May 2015 by Gergely Patay
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
%% current check HY = 2014; HV = 1270; CV_corr = 1270; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 1270

2   Pass
%% out-of-range check 1 HY = 500; HV = 50; CV_corr = NaN; assert(isnan(gold_silver_standard(HY,HV)))

ans = NaN

3   Pass
%% out-of-range check 2 HY = 2500; HV = 5000; CV_corr = NaN; assert(isnan(gold_silver_standard(HY,HV)))

ans = NaN

4   Pass
%% HY = 2010; HV = 1000; CV_corr = 945.54; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 945.5400

5   Pass
%% HY = 2005; HV = 1000; CV_corr = 2603.88; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 2.6039e+03

6   Pass
%% HY = 2000; HV = 1000; CV_corr = 3822.36; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.8224e+03

7   Pass
%% HY = 1995; HV = 1000; CV_corr = 3711.31; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.7113e+03

8   Pass
%% HY = 1990; HV = 1000; CV_corr = 3965.32; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.9653e+03

9   Pass
%% HY = 1950; HV = 1000; CV_corr = 25768.43; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 2.5768e+04

10   Pass
%% HY = 1900; HV = 1000; CV_corr = 30850.44; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.0850e+04

11   Pass
%% HY = 1850; HV = 1000; CV_corr = 14532.01; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 1.4532e+04

12   Pass
%% HY = 1800; HV = 1000; CV_corr = 15471.58; assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 1.5472e+04

13   Pass
%% ind = randi(4); switch ind case 1 HY = 2000; HV = 1000; CV_corr = 3822.36; case 2 HY = 1995; HV = 1000; CV_corr = 3711.31; case 3 HY = 2005; HV = 1000; CV_corr = 2603.88; case 4 HY = 1800; HV = 1000; CV_corr = 15471.58; end assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 2.6039e+03

14   Pass
%% ind = randi(4); switch ind case 1 HY = 1995; HV = 1000; CV_corr = 3711.31; case 2 HY = 1990; HV = 1000; CV_corr = 3965.32; case 3 HY = 2010; HV = 1000; CV_corr = 945.54; case 4 HY = 1900; HV = 1000; CV_corr = 30850.44; end assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.9653e+03

15   Pass
%% ind = randi(4); switch ind case 1 HY = 1990; HV = 1000; CV_corr = 3965.32; case 2 HY = 1950; HV = 1000; CV_corr = 25768.43; case 3 HY = 1900; HV = 1000; CV_corr = 30850.44; case 4 HY = 2000; HV = 1000; CV_corr = 3822.36; end assert(abs(gold_silver_standard(HY,HV)-CV_corr)<2e-5)

ans = 3.8224e+03

Suggested Problems

More from this Author139

Community Treasure Hunt

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

Start Hunting!