Evaluating a function with Matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Danny Guana
il 18 Mag 2022
Commentato: Danny Guana
il 18 Mag 2022
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 Commento
KSSV
il 18 Mag 2022
t = 10 ;
f = -((t-16.82)/5.604)^1.576
The result is clear, you are taking exponent of a negative number.
Risposta accettata
Stephen23
il 18 Mag 2022
Modificato: Stephen23
il 18 Mag 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)
Vedere anche
Categorie
Scopri di più su Logical 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!