Cody

Problem 43026. Determinant of a 3x3 Matrix

Solution 2899640

Submitted on 1 Sep 2020 by Ramesh Kumar V
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('dtrmnt_3x3.m'); assert(isempty(strfind(filetext, 'det')),'det() forbidden')

2   Pass
x = [3 0 2; 2 1 -2; 0 1 1]; y_correct = 13; assert(sum(sum(abs(dtrmnt_3x3(x)-y_correct)))<1e-3)

z1 = 9 z2 = 0 z3 = 4 y = 13

3   Pass
x = [1 40 2; 7 -9 10; 1 0 1]; y_correct = 129; assert(sum(sum(abs(dtrmnt_3x3(x)-y_correct)))<1e-3)

z1 = -9 z2 = 120 z3 = 18 y = 129

Suggested Problems

More from this Author43

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!