Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1632. Calculating Sign Changes in a Row Vector(No Element Is Zero)?

Created by Shahid Ali Murtza

For a row vector V=[7 1 2 -3] has one sign change from 2 to -3. So N=Sign_Changes(V) must return N=1;

 V=[5 9 -2 7]; 

has two sign changes one from 9 to -2 and second -2 to 7, Thus N=2;

Similarly

 V=[-4 -6 -7 -5 -6] and V=[3 7 6 5 6 7 8 7 6] 

has no sign changes.

Problem Group

Solution Statistics

27 correct solutions 10 incorrect solutions
Last solution submitted on Jun 11, 2014