I think you may need to modify some of the tests to "...ensure both odd and even values of x" in all cases where m might be negative.
Hi, Tim. Thanks for your feedback. Actually, from the Player's point of view, m 'could' be negative in any Test. I agree that in some situations there might not be one unique pair of the m & c parameter values that is correct. However, I never apply an assertion to the values of m & c in the Test Suite, rather I check what values of y the user-supplied parameters produce from the user-supplied function(handle). _Any_ valid combination of m & c should be able to REpredict the same values of y provided in the original input, from the same x values (or a subset thereof). There is only one test where I check for prediction of y using x values not included in the original input (extrapolation/interpolation), and for that one test I do have to be careful to ensure there is one unique pair of m & c values that is correct. So I would say this is intentional (I'll add a short note to the Problem Statement). But please let me know if there's a flaw in my logic. —DIV
Aha--I see now. To quote Emily Litella: "Never mind."
I should clarify one detail for other Players. Given y = mˣ + c (elementwise), suppose x is the vector [7 8 5 6] and y is the vector [123 123 123 123]. Then there are two valid combinations of m & c, namely m=0 & c=123 and m=1 & c=122. So actually there is not just one unique set of m & c values in this case. However, given x>0 (in the Problem Statement), either of these alternatives can be correctly extrapolated or interpolated from.
Replace NaNs with the number that appears to its left in the row.
Spiraling out of control....
Recurring Cycle Length (Inspired by Project Euler Problem 26)
Some Assembly Required
The twelve days of Christmas
Code breaker, Part III: Operation Xiangliu
Code breaker, Part I: Operation Phoenix
Back to basics: throwing errors / exceptions
Computational power of Cody servers
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