I don't understand what I'm looking at, Ive attempted to add the code from a solution, but it seems like I'm missing something crutial...
function [P_avg,NP] = cycling_norm_power(power)
P_avg = 0;
NP = 0;
power = 200*ones(1,3600);
P_avg_corr = 200;
NP_corr = 200;
[P_avg,NP] = cycling_norm_power(power);
??????????? really? 4 correct and 5 not?
Same problem as noted in the other comment. You get the correct P_avg here but not NP because the sprint is so short that the 30-second rolling average (applied twice) is rounded to the same answer. Unrounded P_avg answers for this routine and the correct routine are 131.3638 and 131.1111, respectively. Given that answers are being rounded, it may look wrong since the P_avg calculation appears to be right (due to rounding) while NP was wrong when both were actually wrong.
Maybe I'm wrong, but for sure the results in test 4 and 5 is NOT CORRECT
Note in the last paragraph of the explanation: "You will be provided with the 30-second rolling average power data set (vector)." In essence, your solution is calculating the 30-second rolling average of a 30-second rolling average data set.
The Hitchhiker's Guide to MATLAB
Twins in a Window
Back to basics 15 - classes
Generate a vector like 1,2,2,3,3,3,4,4,4,4
Swap two numbers
Large Sum (inspired by Project Euler 13)
Radiation Heat Transfer — View Factors (2)
Divisible by 4
Divisible by 5
Divisible by 14
Find the treasures in MATLAB Central and discover how the community can help you!
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