Question: undefined TOPIC: Intro to Matlab (Array Indexing) Write a program that would create a vector Vec of an array of numbers 1, 2, 3, 4,
undefined
TOPIC: Intro to Matlab (Array Indexing) Write a program that would create a vector Vec of an array of numbers 1, 2, 3, 4, and 5. Calculate the sum of the elements of Vec using array notation and store to variable Sum. Then creates another variable Ave as the average of these five numbers of array Vec. Print the sum and average to the screen using the command fprintf("The sum and average of the numbers 1, 2, 3,4 and 5 are %d and %2.2f respectively ", Sum, Ave). Use Filename: Sum_Ave.m. Script @ C Reset MATLAB Documentation 1 % Create a vector of array named as Vec. Use space as the separator of the elements. 2 Vecul 3 5 4 %Find the sum of the array numbers using the variable Vec and store to Sum. Sum= 6 % the average of the numbers using Vec and store to Ave. 7 Ave 8 fprintf("The sum and average of the numbers 1, 2, 3,4 and 5 are %d and %2.2f respectively ", Sum, Ave) 9 Run Script
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
