finding the determinant of a non function without using built-in functions
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i want to calculate the det of a nxn matrix without using built in functions. I've done this so far, could anyone help me write the rest?
might appriciated.
mat = input("your mat");
sz = size(mat);
if sz(1) ~= sz(2)
disp("your mat is not nxn")
end
Risposte (1)
Steven Lord
il 31 Mar 2022
Your function does not satisfy your stated requirements. All of input, size, ne (the function form of the ~= operator), and disp are built-in functions.
If the requirement is for you to implement this function without using the built-in det function or an equivalent, this sounds like a homework assignment. If it is, I'm guessing your textbook or class notes should show a pseudocode that you can implement in MATLAB. If while implementing that pseudocode you have difficulties, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
If this isn't homework, either just use the det function (if you really need the determinant) or (if you're trying to determine if a matrix is singular) use the cond, rcond, or condest functions instead of det.
A = eye(500); % Not singular
B = 0.1*A; % Also not singular
det(B) % Why is this 0? Underflow.
cond(B) % But B is "well behaved" and not singular
0 Commenti
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!