Cody

Problem 3064. Cycling — Normalized Power

Solution 2244300

Submitted on 29 Apr 2020
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   Fail
power = 200*ones(1,3600); P_avg_corr = 200; NP_corr = 200; [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test1 (line 4) [P_avg,NP] = cycling_norm_power(power);

2   Fail
power = 100*ones(1,60); power = [power 250*ones(1,240)]; power = [power 100*ones(1,60)]; power = repmat(power,[1,10]); P_avg_corr = 200; NP_corr = 227; [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test2 (line 7) [P_avg,NP] = cycling_norm_power(power);

3   Fail
power = 100*ones(1,30); power = [power 100:249]; power = [power 250:-1:101]; power = [power 100*ones(1,30)]; power = repmat(power,[1,10]); P_avg_corr = 163; NP_corr = 182; [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test3 (line 8) [P_avg,NP] = cycling_norm_power(power);

4   Fail
power = 100*ones(1,170); power = [power 500*ones(1,20)]; power = [power 100*ones(1,170)]; power = repmat(power,[1,10]); P_avg_corr = 122; NP_corr = 244; [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test4 (line 7) [P_avg,NP] = cycling_norm_power(power);

5   Fail
power = 100*ones(1,176); power = [power 1500*ones(1,8)]; power = [power 100*ones(1,176)]; power = repmat(power,[1,10]); P_avg_corr = 131; NP_corr = 579; [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test5 (line 7) [P_avg,NP] = cycling_norm_power(power);

6   Fail
ind = randi(5); switch ind case 1 power = 200*ones(1,3600); P_avg_corr = 200; NP_corr = 200; case 2 power = 100*ones(1,60); power = [power 250*ones(1,240)]; power = [power 100*ones(1,60)]; power = repmat(power,[1,10]); P_avg_corr = 200; NP_corr = 227; case 3 power = 100*ones(1,30); power = [power 100:249]; power = [power 250:-1:101]; power = [power 100*ones(1,30)]; power = repmat(power,[1,10]); P_avg_corr = 163; NP_corr = 182; case 4 power = 100*ones(1,170); power = [power 500*ones(1,20)]; power = [power 100*ones(1,170)]; power = repmat(power,[1,10]); P_avg_corr = 122; NP_corr = 244; case 5 power = 100*ones(1,176); power = [power 1500*ones(1,8)]; power = [power 100*ones(1,176)]; power = repmat(power,[1,10]); P_avg_corr = 131; NP_corr = 579; end [P_avg,NP] = cycling_norm_power(power); assert(isequal(P_avg_corr,P_avg)) assert(isequal(NP_corr,NP))

Error using round Too many output arguments. Error in cycling_norm_power (line 3) [P_avg, NP] = round([mean(power), nthroot(mean(power.^4),4)]); Error in Test6 (line 37) [P_avg,NP] = cycling_norm_power(power);

Community Treasure Hunt

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

Start Hunting!