Question: Matlab Question This problematic program should sum together all of the numbers in both input arrays and returns that sum as the output. ( assuming

Matlab Question
This problematic program should sum together all of the numbers in both input
arrays and returns that sum as the output. (assuming "array1" and "array2"
have same length) Which one of the following statements is a reasonable
correction? (Note: the correction may not fully fix the function)
function [totalSum]= programToFix(array1,array2)
totalSum =1;?1
n=array1;
for i=1:1:n?2
totalSum =array1(i)+array2(i)+ totalSum; ?3
end
Location ?1: "totalSum" shall be initialized as 0
Location ?2: counting variable "i" shall go as "i=n:1:1"
Location ?2: interval of counting variable shall be "2" instead of "1"
Location ?3: "+ totalSum" shall be removed from righhand-side of "="

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!