Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 45866. Average of corner elements of a matrix (**) Like (0) Difficulty: .00 (27) Rate Solve Later Add To Group (copy of prob 2235)
Problem 45866. Average of corner elements of a matrix (**) Like (0) Difficulty: .00 (27) Rate Solve Later Add To Group (copy of prob 2235) Calculate the average of corner elements of a matrix. e.g.x=[1 2 3; 4 5 6 7 8 9;] avg = (1+3+7+9)/4 = 5 Solution DE MATLAB Documentation 1 function avg = MeanCorner(x) avg = 1; end Submit Click submit to create a new solution. Submitting an incorrect solution will not display your name to other players, and it does not affect your score. By clicking 'Submit you agree to our Terms of Use. Test Suite Test Code Input 1 x = [1 2 3; 4 5 6; 7 8 9] y_correct = 5; assert(isequal(MeanCorner(x),y_correct)) 2 %% x = magic(4) y_correct - 8.5; assert(isequal(MeanCorner(x),y_correct)) 3 x = eye(4) y_correct = 0.5; assert(isequal(MeanCorner(x),y_correct)) 4 x = repmat(5, 4,4); y_correct = 5; assert(isequal(MeanCorner(x),y_correct)) 5 x = (1:10); y_correct = 5.5; assert(isequal(MeanCorner(x),y_correct))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started