I'm new at Mathematica so please bear with me. I am trying to create an interactive plot that will end up looking like this:
I want to input values for certain variables and then plot a curve.
This is what I have now.
Manipulate[
Plot[
y = -((P*x^2)/(6*R*S)) (3*a - x),
{x, 0, 10}],
{P, 0, 10},
{R, 0, 10},
{S, 0, 10},
{a, 0, 10}
]
Instead of slider bars, I want to have input boxes.
I have a few other issues. I don't know how to program a square. I believe this should be done piecewise, but I'm not sure how to do it on the same plot as my curve. Also, I'd like it so that the y-intercept auto manipulates so that the curve always touches the corner of the square. This might be a tad harder because I also want to add
y = -((P*x^2)/(6*R*S)) (3*a - x)cos[[Theta]]
Is that even possible?
Thanks for the help.
edit: working off of @MarcoB 's advice, I got this now.
Manipulate[
Show[
Graphics[{Rectangle[{1, 2}, {2, 4}]}],
Plot[
-(Px^2/6) (3 - x),
{x, 0, 1}],
{P, 2, 10}
]
]
edit 2: Working off of @MarcoB 's next comment, I managed to get a plot looking like this:
My code is:
Manipulate[
Show[
Graphics[{Rectangle[{1, 2}, {2, 3}]}],
Plot[
-(Px^2/6) (3 - x),
{x, -2, 10},
PlotStyle -> green],
PlotRange -> {{-2, 10}, {-2, 10}},
Axes -> True
],
{P, -10, 10}
]
y =
in your plotting expression; 2. look upRectangle
,Graphics
, andShow
, in a combination asShow[Graphics[{Rectange[yourspecs]}], Plot[plottingArguments]]
; 3. SeeInputField
as a control type for Manipulate. $\endgroup${P, 2, 10}
fragment should be insideManipulate
, but outsideShow
, so... {x, 0, 1}]], {P, 2, 10}]
$\endgroup$