2015-10-21 111 views
0

我想绘制一个线性方程组的解决方案区域,但我希望能够一次绘制一个方程(然后“分层”)而不是一次绘制所有方程。我无法弄清楚如何使用Manipulate函数来做到这一点。我使用CheckboxBar吗?这是我到目前为止有:使用Manipulate选择性绘制函数

points1 := Table[{i - 1, j - 1}, {i, 70}, {j, 70}] 
Show[ListPlot[points1, PlotRange -> {{0, 70}, {0, 70}}, ImageSize -> 850, 
AxesLabel -> {"Racing Cars", "Sport-Utility Cars"}, PlotStyle -> 
Directive[RGBColor[0.45, 0.67, 0.82, 0.82], PointSize[0.005]], LabelStyle -> 
Medium], 
RegionPlot[{R <= 40, S <= 60, R + S >= 70}, {R, 0, 70}, {S, 0, 70}, 
PlotLegends -> "Expressions"]] 

希望的就是有一次绘制只有一个公式的能力。例如,

Manipulate[Plot[function[frequency*x + phase], {x, -6.6, 6.6}], {frequency, 1, 5}, 
{phase, 1, 10}, {function, {Sin, Cos, Tan}}] 

(对不起,新手在这里......我发誓,我没有做彻底的谷歌搜索,但没有一个例子,我发现有帮助到我的情况。)

非常感谢!

+0

请看这里:http://mathematica.stackexchange.com/questions/11274/how-to-connect-a-checkbox-with-part-of-the-graphics – agentp

+0

谢谢,@agentp!我试过这个解决方案,但有些东西没有工作(见下文)。我究竟做错了什么? 操作[ 显示[RegionPlot [R≤40,{R,0,70},PlotStyle - > Opacity [plot1]], RegionPlot [S <= 60,{S,0,70},PlotStyle->不透明度[plot2]], RegionPlot [R + S> = 70,{R,0,70},{S,0,70}, PlotStyle - > Opacity [plot3]]], {{plot1,1,复选框},{{plot2,1,“S \ [LessEqual] 60”},{0,1}, 复选框},{{plot3, 1,“R + S \ [GreaterEqual] 70”},{0,1},复选框}, ControlPlacement - > Left] – ChunkyRice

+0

我建议在其他网站上询问..更多的专业知识。 – agentp

回答

0

您对该帖子的评论有语法错误。 RegionPlot需要定义两个变量。

Manipulate[ 
Show[ 
    RegionPlot[R <= 40, {R, 0, 70}, {S, 0, 70}, PlotStyle -> {Opacity[plot1], Orange}], 
    RegionPlot[S <= 60, {R, 0, 70}, {S, 0, 70}, PlotStyle -> {Opacity[plot2], Blue}], 
    RegionPlot[R + S >= 70, {R, 0, 70}, {S, 0, 70}, PlotStyle -> {Opacity[plot3], Brown}] 
    ], 
{{plot1, 0, "R <= 40"}, {0, .5}, Checkbox}, 
{{plot2, 0, "S <= 60"}, {0, .5}, Checkbox}, 
{{plot3, 0, "R + S >= 70"}, {0, .5}, Checkbox}, 
ControlPlacement -> Left] 

enter image description here

希望这有助于。