Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a matrix the looks like the following; a = [5 -23 8 19 -3 -7] Assign vari

ID: 3788701 • Letter: C

Question

Create a matrix the looks like the following; a = [5 -23 8 19 -3 -7] Assign variable names to the following items: Call each of the functions listed below Use 'fprintf' statements to verify each function works correctly Functions: Write a function capable of finding the minimum value within any sized matrix. The function is to be named as: min_yourusername. m Write a function capable of finding the maximum value within any sized matrix. The function is to be named as: max_yourusername .m Write a function capable of finding the mean value of any sized matrix. The function is to be named as mean_yourusername .m Write a function that returns the Relative True Error (%)^1.The function is to be named as: True_error_your username .m write a function that returns the Absolute Relative Error (%)^2.The function is to be named as: Abs_error_yourusername .m Permitted MATLAB Functions (use of other functions will result in a zero grade for the home work)

Explanation / Answer

Here are the required functions for you:

function minValue = min_myFunction(A)

minValue = A(1, 1);

[rows cols] = size(A);

for i = 1 : rows

for j = 1 : cols

if(A(i, j) < minValue)

minValue = A(i, j);

end

end

end

end

function maxValue = max_myFunction(A)

maxValue = A(1, 1);

[rows cols] = size(A);

for i = 1 : rows

for j = 1 : cols

if(A(i, j) > maxValue)

maxValue = A(i, j);

end

end

end

end

function mean = mean_myFunction(A)

sum = 0;

[rows cols] = size(A);

for i = 1 : rows

for j = 1 : cols

sum = sum + A(i, j);

end

end

mean = sum / (rows * cols);

end

function relativeTrueError = True_error_myFunction(currentApproximation, previousApproximation)

return abs((currentApproximation - previousApproximation) / currentApproximation)

end

function absoluteError = Abs_error_myFunction(currentApproximation, exactSolution)

return abs((currentApproximation - exactSolution) / currentApproximation)

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote