how do I write 2^-x in MatLab?
7 次查看(过去 30 天)
显示 更早的评论
I need to run a algorithm where 2^(-x) is included.
0 个评论
回答(2 个)
Fangjun Jiang
2023-2-17
x=1;
2^(-x)
1 个评论
John D'Errico
2023-2-17
编辑:John D'Errico
2023-2-17
The parens are not technically needed there, but they don't hurt anything.
x = 1;
2^-x
And to be honest, I usually put a parens in something like that myself just to make it easier to read. Sometimes spare parens make things more clear, and sometimes they just create a confusing mess, creating a parenthetical balancing act.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
