Evaluating a function with Matlab
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello friends,
Can anyone help me figure out why I am getting an imaginary number in the following code:
I am supposed to get 1.36. I have done the same calculation using my scientific calculator and symbolab and cannot find what the error is in my code.
댓글 수: 1
KSSV
2022년 5월 18일
t = 10 ;
f = -((t-16.82)/5.604)^1.576
The result is clear, you are taking exponent of a negative number.
채택된 답변
Stephen23
2022년 5월 18일
편집: Stephen23
2022년 5월 18일
"Can anyone help me figure out why I am getting an imaginary number in the following code:"
Because you are taking the power of a negative number.
"I am supposed to get 1.36."
The simple, effiicient, MATLAB approach is to use REALPOW:
t = 10 ;
f = realpow(-((t-16.82)/5.604),1.576)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!