Return a combination of vectors x1, x2 based on y1, y2 per:
x(j) = 0 if y1(j) < y2(j)
x(j) = x1(j) if y1(j) = y2(j)
x(j) = x2(j) if y1(j) > y2(j)
Vectors can have any length, consistent orientation.
this test suite is broken. All the tests try to submit variables into the function that have not been declared yet. i.e. the first assertion is submitting x14 and y14 that are declared 16 lines later.
Thanks Andrew. I should have test-solved it but I didn't want to be the first. I'll gladly fix it.
Andrew, thx again. I had pasted the self-checkers into the test suite in the incorrect order...
Jerry, you can test your solution against the test suite before posting the problem. On the edit page for the problem, there is space for a reference solution at the bottom along with a button to test the reference solution. It is good practice to include a reference function for each created problem to ensure that the test suite is solvable.
Thanks for the advice - that's my first posted problem!
Maximum running product for a string of numbers
Angle between Two Vectors
What number has this problem?
Sum the 'edge' values of a matrix
What is Sum Of all elements of Matrix
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