Matlab 分数转浮点数

发布于 2024-07-17 13:10:38 字数 426 浏览 4 评论 0原文

在对具有一个变量的方程使用“求解”函数后,Matlab 似乎不喜欢使用浮点。 所以,我的答案是

ans = -2515439103678008769411809280/29019457930552314063110978530889-1/232155663444418512504887828247112*13479465975722384794797850090594238631144539220477565900842902305^(1/2)

,我不确定将其转换为可理解的小数的最佳方法是什么。 到目前为止,我拥有的最好的方法是

eval(char(ans))

(对于那些跟踪的人来说,它给了我-0.5002),但我对这个解决方案并不是很满意。

谁能建议更好的东西吗?

After using the 'solve' function on an equation with one variable, it seems like Matlab doesn't like using floating point. So, my answer is

ans = -2515439103678008769411809280/29019457930552314063110978530889-1/232155663444418512504887828247112*13479465975722384794797850090594238631144539220477565900842902305^(1/2)

and I'm not sure what the best way to convert it to an understandable decimal is. The best way I have so far is

eval(char(ans))

(which gives me -0.5002 for those keeping track), but I'm not really happy with that solution.

Can anyone suggest something better?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回心转意 2024-07-24 13:10:38

好吧,我查看的下一页就有了答案。 这是“双重”功能:

double(ans)

Well, the very next page I looked at had the answer. It's the 'double' function:

double(ans)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文