Problem 1 Write a function that accepts any number of numeri
Problem 1) Write a function that accepts any number of numeric input variables. The function adds up all the elements in those variables and returns the sum. Verify that your function works by passing the following input variables. Using Matlab
2 111. a=5, b=[-3 5 1-1], c= 2 -1 3 5 2 -2 2 4Solution
%Code here
x=input(\'Enter no variables :\');
for j=1:x
   
 g(j)=sum(sum(input([\'Enter variable no \',num2str(j),\':\'])));
   
 end
Sum=sum(g)
%Results
Enter no variables :2
 Enter variable no 1:5
 Enter variable no 2:-2
Sum =
3
Enter no variables :2
 Enter variable no 1:[2;-2;4]
 Enter variable no 2:[-3 0 1 -1]
Sum =
1
Enter no variables :4
 Enter variable no 1:5
 Enter variable no 2:[-3 5 1 -1]
 Enter variable no 3:[2;-4]
 Enter variable no 4:[2 -1 3;5 2 -2]
Sum =
14

