Why does this showing inf?

조회 수: 10 (최근 30일)
Farshad Afzali
Farshad Afzali 2017년 9월 20일
댓글: Christoph F. 2017년 9월 20일
Hi guys,
I appreciate it if some one can tell me what's the problem with my code that shows inf?
n=linspace(1,10^9,10);
y=exp(1);
e=(1+(1\n)).^n;
error=abs(y)-abs(e)/abs(y)

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 20일
Look at the value of 1\n .
Are you certain that you intended to use Matrix Left Divide rather than ./ ?
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 9월 20일
/ is Matrix Right Divide. You want Right Divide which is ./
Christoph F.
Christoph F. 2017년 9월 20일
Forget my earlier answer, this is the correct one.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by