Matlab 公式方程编辑器 GUI

发布于 2024-12-21 00:49:05 字数 122 浏览 2 评论 0原文

我如何从 GUI 执行方程式? 例子: 在此处输入图像描述 我如何用各种类型的方程来做到这一点?

谢谢各位的解答。

How i can execute an equation from GUI?
Example:
enter image description here
How i can do this with various type of equation?

Thanks the answers.

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

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

发布评论

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

评论(1

挽手叙旧 2024-12-28 00:49:06

我不完全确定你的意思,但我认为你想获取用户在文本框中输入的方程并将其转换为函数?

为什么您的 F 从 3 个参数变为 4 个?即 F(x,y,y') --> F(1,0,5,-1) 在下一行? (您给出的 F 示例似乎与您的方程不匹配。)

无论如何,请查看 eval(),也许这就是您想要的。
它以字符串形式接收 matlab 命令,例如 2 + 3,并对其求值。

那么

eval('2+3') % gives 5
eval('f=@(x,y,ydash) y*sqrt(1+ydash^2)')  % gives a function f
f(1,5,-2) % gives 11.1803

,但是无论如何,您希望用户如何输入平方根符号和平方符号呢? eval() 方法依赖于输入 matlab 能够理解的语法。

如果您进一步澄清您的问题,这会更容易。

I'm not entirely sure what you mean, but I think you want to grab the equation that a user types in to a text box and turn it in to a function?

Why does your F change from 3 arguments to 4? i.e. F(x,y,y') --> F(1,0,5,-1) in the next line? (The examples of F you gave don't seem to match up with your equation..)

In any case, check out eval(), perhaps that is what you want.
It takes in a matlab command as a string, e.g. 2 + 3, and evalutes it.

So

eval('2+3') % gives 5
eval('f=@(x,y,ydash) y*sqrt(1+ydash^2)')  % gives a function f
f(1,5,-2) % gives 11.1803

But in any case, how do you expect the user to type in the square root symbol and the squared symbol? The eval() approach relies on them typing in syntax that matlab will understand.

If you clarify your question a bit more this will be easier.

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