Outline
The singularityTest function will test whether a matrix is singular (i.e., not invertible). If it is singular, the output should be 1. Otherwise, the output should be 0. The input, A, can be any n × n matrix.
Your code needs to take into consideration very small errors that could occur due to floating point arithmetic (apply a tolerance of 10-10).
This is my code
function result = singularityTest(A)
if det(A)== 0
result = 1;
else
result = 0;
end
end
Question
How do I apply the tolerance (10-10) to my code

 채택된 답변

darova
darova 2020년 4월 22일

0 개 추천

Use this trick

댓글 수: 2

Nicholas Gresham
Nicholas Gresham 2020년 4월 25일
Yes that worked thankyou for your help
Josh Taylor
Josh Taylor 2020년 4월 27일
ayee Nicholas i see what this question is from XD

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Specialized Power Systems에 대해 자세히 알아보기

질문:

2020년 4월 22일

댓글:

2020년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by