Evaluating a function with Matlab
3 views (last 30 days)
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.
Stephen23 on 18 May 2022
Edited: Stephen23 on 18 May 2022
"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)