Question: MATLAB will give thumbs up if code functions How many times divide by zero? Write a function Divide that divides two numbers, and keep count

MATLAB will give thumbs up if code functions MATLAB will give thumbs up if code functions How many times divide

How many times divide by zero? Write a function Divide that divides two numbers, and keep count of how many times the function was called asking to divide by zero The function has two output, the division of the two numbers and the number of times the function was called with a divide-by-zero request. In the case of a divide-by-zero request, the resultant should be set to not a number. The function must make use of a persistant variable. For example >> clear all; x=1; y=1; [z,times] Divide(x,y) times = >> x=1; y=0; [z,times] Divide(x,y) = NaN times = 1 [z,times] = Divide(x,y) >> x-2; howmany y=0; 2 NaN times = 2 Your Function Save Reset MATLAB Documentation 1 function [z,times] = Divide (x,y) % Your code goes here % s end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!