please help For all parts of this problems, unless explicitly told otherwise, yo
ID: 3552476 • Letter: P
Question
please help
For all parts of this problems, unless explicitly told otherwise, you will receive zero credit if you use built-in functions such as sum to compute the solution to the problem. You are allowed to call any functions you wrote in previous parts of the problem. Write a function that computes the sum of a sequence. The values to add will be stored in an array x that will be passed into your function as an argument. Your function should return the sum s that satisfies the following equation: Write a fund ion that computes the mean value of a sequence. The values to average will be stored in an array x that will be passed into your function as an argument. Your function should return the mean value x_bar that satisfies the following equation: Write a function that computes the sum of squared residuals about the mean (Si), which can be computed using the following formula: Your function will receive the array x as an input argument, and should return the value of S_t. Write a function that computes the standard deviation of a sequence. The variance can be computed using the following formula: Your function will receive the array x as an input argument, and should return the value of Find the sum, mean, and standard deviation of the data series X = [25.70.380,550.610.1220.830.1450] . Show that your answers match the results given by the MATLAB functions sum(), meanO and std().Explanation / Answer
a)
function [total] = FindSum(x)
l = size(x);
total = 0
for i = 0:l-1
total = total + x(i);
end
b)
function [mean] = FindMean(x)
total = FindSum(x)/size(x);
c)
function [squareSum] = FindSquare(x)
mean = FindMean(x);
squareSum=0;
l = size(x);
for i = 0:l-1
squareSum = squareSum + (x(i)-mean)^2;
end
d)
function [stdDev] = FindStdDev(x)
stdDev = sqrt(1/(size(x)-1)*FindSquare(x));
e)
sum = 5135
mean = 641.875
stdDev = 475.4336
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.