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

1 Ansicht (letzte 30 Tage)
Emily Gallagher
Emily Gallagher am 24 Sep. 2019
Kommentiert: James Tursa am 24 Sep. 2019
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 Kommentar
James Tursa
James Tursa am 24 Sep. 2019
What is the purpose of creating the A matrix inside this function?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KALYAN ACHARJYA
KALYAN ACHARJYA am 24 Sep. 2019
Bearbeitet: KALYAN ACHARJYA am 24 Sep. 2019
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!

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by