Cody

Problem 2069. Parallel vectors

Solution 1506526

Submitted on 27 Apr 2018
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
p1=[1 2 3]; p2=[2 4 6]; y_correct = true; assert(isequal(isparallel(p1,p2),y_correct))

k = 0 0 0

Operands to the || and && operators must be convertible to logical scalar values. Error in isparallel (line 8) if (k==0)||(p2~=0) Error in Test1 (line 4) assert(isequal(isparallel(p1,p2),y_correct))

2   Fail
p1=[1 2 3]; p2=[2 5 6]; y_correct = false; assert(isequal(isparallel(p1,p2),y_correct))

k = -3 0 1

Operands to the || and && operators must be convertible to logical scalar values. Error in isparallel (line 8) if (k==0)||(p2~=0) Error in Test2 (line 4) assert(isequal(isparallel(p1,p2),y_correct))

3   Fail
p1=[666 911]; p2=[0.1 0.1*911/666]; y_correct = true; assert(isequal(isparallel(p1,p2),y_correct))

p1 = 666 911 0 p2 = 0.1000 0.1368 0 k = 0 0 0

Operands to the || and && operators must be convertible to logical scalar values. Error in isparallel (line 8) if (k==0)||(p2~=0) Error in Test3 (line 4) assert(isequal(isparallel(p1,p2),y_correct))

4   Fail
p1=[1 2 3]; p2=[0 0 0]; y_correct = false; assert(isequal(isparallel(p1,p2),y_correct))

k = 0 0 0

Operands to the || and && operators must be convertible to logical scalar values. Error in isparallel (line 8) if (k==0)||(p2~=0) Error in Test4 (line 4) assert(isequal(isparallel(p1,p2),y_correct))

Suggested Problems

More from this Author10

Community Treasure Hunt

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

Start Hunting!