Write a MATLAB FUNCTION numbers using a for LOOP to determin

Write a MATLAB FUNCTION (numbers) using a for LOOP to determine the number of values that are positive, the number of values that are negative. You program counts a zero as a negative number. Prompt the user to enter the vector of values and then display the number of positive, and negative values.

Solution

postive = 0

negative = 0

list = input(\'Input your vector:\')

for ele = list

    if ele > 0

        positive = postive+1

   else

       negative = negative+1

   end

end

disp(positive)

disp(negative)

Write a MATLAB FUNCTION (numbers) using a for LOOP to determine the number of values that are positive, the number of values that are negative. You program coun

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site