Why do I keep getting an undefined function for 'deter'?

조회 수: 2 (최근 30일)
Emily Gallagher
Emily Gallagher 2019년 9월 24일
댓글: James Tursa 2019년 9월 24일
Trying to find the determinant of an upper triangular matrix without using the built-in det function. Why do I keep getting an undefined function error for 'deter'?
function d = deter (U)
n = 4;
A = rand(n,n);
d = prod(diag(U));
end
  댓글 수: 1
James Tursa
James Tursa 2019년 9월 24일
What is the purpose of creating the A matrix inside this function?

댓글을 달려면 로그인하십시오.

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 9월 24일
편집: KALYAN ACHARJYA 2019년 9월 24일
function d=deter (U)
n=4;
A=rand(n,n);
d=prod(diag(U));
end
Save the function in new matlab file (save as deter.m), Next call the function from command window or another main script. Please note that you have pass the input arguments (U) to the function form command window or another main Matlab script as shown below.
76.png
Hope it helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by