Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called RoundZero() that iterates through each value in a matrix and rounds positive numbers to the nearest integer, and sets negative numbers

Write a function called "RoundZero()" that iterates through each value in a matrix and rounds positive numbers to the nearest integer, and sets negative numbers equal to zero.

Your function takes a single input variable:

  • M - a matrix of floating point double numbers.

Your function has three outputs:

  • Mout - the matrix with rounded and zeroed values
  • nr - the number of positive elements rounded.
  • n0 - the number of negative elements set to zero, or originally zero.

Step by Step Solution

3.31 Rating (148 Votes )

There are 3 Steps involved in it

Step: 1

Heres an implementation of the RoundZero function in Python import numpy as ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elementary Statistics

Authors: Robert R. Johnson, Patricia J. Kuby

11th Edition

978-053873350, 9781133169321, 538733500, 1133169325, 978-0538733502

More Books

Students also viewed these Mathematics questions

Question

Determine A in the indicated figures. Fig. 2.40 (a) A 84 (a) 40 B

Answered: 1 week ago