Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The MATLAB program as follow was designed to sum an array and display the sum of the array is not empty and Goes not contain

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The MATLAB program as follow was designed to sum an array and display the sum of the array is not empty and Goes not contain any negative values. The program has seves content rutine, and logic errors and verify that the program operates correctly for the three testas First correct any syntax errors. To help identify runtime and logic errors use the MATLAB debugger (On your own installation) and set breakpoints at each of the statements in the blocks of the statements. Using the debugger, Identity and correct the program logic errors (watch which block of the conditional statement is executed for the test cases and ensure the correct operation is being performed based on the test case. Verify the program operates correctly for all the test cases Function e Reset MATLAB Documento 1 function y wyFunction() compute sum of x as long as is not only and contains no negative values if (septy(x) > 0) SUNX - Sun): weil isempty() SUNK - 1 SUMX-1; end * displays or negative value message. Handle display here in function is reneral not cood Idea, we it just to the problemuster for you to if (UK - 1) forintfx has negative values): else isompty() fprintf('imptyin): 16 fprintf(Sun is in'. SUX): end I Lassie the return value y su 23 end Code to call your function 1 % program test cases 2 X = [1, 2, 3, 4, 5, 6, 7]; 3 % x [1, 2, 3, 4, 5, 6, -7]; 4 % x = []; = 5 6 7 my Function(x) Function 2 3 4 5 1 function y = my Function(x) % compute sum of x as long as x is not empty and contains % no negative values if (~ismepty(x) && x >= 0) sumX = sum(x); elseif isempty(x) sumX = []; else sumX = -1; end 6 7 00 9 10 11 12 13 14 15 % display sum or negative value message. Handle display here in a functi if (sumx = -1) fprintf('x has negative values '); elseif isempty(x) fprintf('x is empty "); else fprintf('Sum is %0.1f ', sumx); end 16 17 18 19 20 21 %assign the return value 22 y=sumx; 23 end 24 25 The MATLAB programas sow was designed to sum at way and dolay the sun if the array is now and does not contain any negative value. The program has ever.corect the syntax rucime and logos and verify that the program per correctly for the three dit.com content tax errors. To identity intendonon MATLAB bogers you cannotation and set points al cath of the back of the wameteng botontily and conecte program bogit error (Walth which block of the condition sted for the ensure the correct operation is being performed based on the time. Verly the program operates correct for all the best catet The MATLAB program as follow was designed to sum an array and display the sum of the array is not emply and does not contain any negative was the program has serveras con le syntax Funtime, and logle errors and verify that the program operates correctly for the three test cas First correct any syntax errors. To help identity runtime and logic errors use the MATLAB debugger (On your own installation) and set breakports at each of the statements in the blocks of the statements. Using the debugger, dentify and correct the program logic errors (watch which block of the conditional statement is executed for the lost cases and enture the correct operation is being performed based on the test case. Verify the program operates correctly for all the test cases

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Why do firms focus on promotional activities?

Answered: 1 week ago

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago