我如何定位和定位调整 Mathematica 操作面板中的输出大小?

发布于 2024-10-21 20:40:57 字数 837 浏览 1 评论 0原文

以下代码允许您使用惠斯通电桥中的值。输出显示在滑块的右侧。如何使输出面板 (expr) 出现在其他位置以及如何设置固定大小? (我只能找到用于操作控件大小和位置的选项,而不是 Manipulate 文档中的输出。)

Manipulate[
 Evaluate[(10^Rx/(10^R3 + 10^Rx) - 10^R2/(10^R1 + 10^R2))*Vin] "V",
 {{R1, 5}, 1, 6, 0.01},
 Pane["R1  = " Dynamic[Round[10^R1] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R2, 5}, 1, 6, 0.01},
 Pane["R2  = " Dynamic[Round[10^R2] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R3, 5}, 1, 6, 0.01},
 Pane["R3  = " Dynamic[Round[10^R3] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}],
 {{Rx, 5}, 1, 6, 0.01},
 Pane["Rx  = " Dynamic[Round[10^Rx] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}],
 {{Vin, 2.5}, 0, VMax, Appearance -> "Open"}]

在此处输入图像描述

The following code allows you to play with the values in a Wheatstone Bridge. The output appears to the right of the sliders. How do I make the output panel (expr) appear somewhere else and how do I set a fixed size? (I can only find options for manipulating size and position of Controls, not the output in the Manipulate docs.)

Manipulate[
 Evaluate[(10^Rx/(10^R3 + 10^Rx) - 10^R2/(10^R1 + 10^R2))*Vin] "V",
 {{R1, 5}, 1, 6, 0.01},
 Pane["R1  = " Dynamic[Round[10^R1] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R2, 5}, 1, 6, 0.01},
 Pane["R2  = " Dynamic[Round[10^R2] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R3, 5}, 1, 6, 0.01},
 Pane["R3  = " Dynamic[Round[10^R3] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}],
 {{Rx, 5}, 1, 6, 0.01},
 Pane["Rx  = " Dynamic[Round[10^Rx] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}],
 {{Vin, 2.5}, 0, VMax, Appearance -> "Open"}]

enter image description here

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

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

发布评论

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

评论(1

红玫瑰 2024-10-28 20:40:57

好吧,如果您可以相对于内容框定位控件,那么您也可以相对于控件定位内容框,不是吗?

因此,ControlPlacement 应该处理盒子的位置,并将其放入 Pane 中负责调整其大小(使用 ImageSize,尽管似乎它从控件大小中获取最小大小)。

VMax = 12;
Manipulate[
 Pane[ToString[(10^Rx/(10^R3 + 10^Rx) - 10^R2/(10^R1 + 10^R2))*Vin] <> 
   "V", ImageSize -> {500, 20}], {{R1, 5}, 1, 6, 0.01}, 
 Pane["R1  = " Dynamic[Round[10^R1] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R2, 5}, 1, 6, 0.01}, 
 Pane["R2  = " Dynamic[Round[10^R2] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R3, 5}, 1, 6, 0.01}, 
 Pane["R3  = " Dynamic[Round[10^R3] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{Rx, 5}, 1, 6, 0.01}, 
 Pane["Rx  = " Dynamic[Round[10^Rx] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{Vin, 2.5}, 0, VMax, 
  Appearance -> "Open"}, ControlPlacement -> Bottom]

在此处输入图像描述

编辑[CapitalOmega] 更改为 \[CapitalOmega]。谢谢贝利撒留。

新图片。谢谢向导。

Well, if you can position the controls with respect to the content box then you're positioning the content box wrt the controls as well, aren't you?

So, ControlPlacement should take care of the position of your box, and putting it in a Pane takes care of sizing it (with ImageSize, although it seems that it takes its minimum size from the control sizes).

VMax = 12;
Manipulate[
 Pane[ToString[(10^Rx/(10^R3 + 10^Rx) - 10^R2/(10^R1 + 10^R2))*Vin] <> 
   "V", ImageSize -> {500, 20}], {{R1, 5}, 1, 6, 0.01}, 
 Pane["R1  = " Dynamic[Round[10^R1] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R2, 5}, 1, 6, 0.01}, 
 Pane["R2  = " Dynamic[Round[10^R2] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{R3, 5}, 1, 6, 0.01}, 
 Pane["R3  = " Dynamic[Round[10^R3] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{Rx, 5}, 1, 6, 0.01}, 
 Pane["Rx  = " Dynamic[Round[10^Rx] "\[CapitalOmega]"], 
  ImageMargins -> {{2.5, 0}, {3, 0}}], {{Vin, 2.5}, 0, VMax, 
  Appearance -> "Open"}, ControlPlacement -> Bottom]

enter image description here

EDIT Changed [CapitalOmega] to \[CapitalOmega]. Thanks Belisarius.

New picture. Thanks Wizard.

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