I have two functions h2 and v2 that I need to graph using Piecewise and be able to manipulate certain variables in the equations. Whatever I try, my code returns a blank plot.
Manipulate[
Plot[
Piecewise[
{{{h2[t], t0 < t}, 0},
{{v2[t], 0 < t < t0}, 0}}],
{t, 0, 500}],
{{t, 0, Time}, 0, 500},
{{A, 200, Alpha}, 0, 500},
{{B, 1, Bravo}, 0, 50},
{{C, 0.5, Charlie}, 0, 50},
{{D, 0.1, Delta}, 0, 1}]
I know that both of my functions h2 and v2 are correct.
As you can see, v2 starts at t=0 and ends at t=t0, and h2 starts at t=t0.
I tried removing the t Manipulator to no avail.
Here are equations v2 and h2:
v2[t] = -((C g)/D) - g (-(C/D) + t) + A Log[(D + B)/B]
h2[t] = (A C)/D - (C^2 g)/(2 D^2) - (g t^2)/2 -
(A B Log[(C + B)/B])/D + A t Log[(C + B)/B]
tas the independent variable inside thePlotcommand and atas aManipulated variable. There might be some conflict there. Otherwise, without the definitions ofh2[t]andv2[t], it's hard to know what's going wrong. Have you tried coming up with a simpler version first that doesn't have so many moving parts (i.e. so many parameters) so that you can narrow in on what might be the issue? That's good trouble-shooting practice. – march Oct 29 '15 at 05:39tandt0. I'm guessing that{{t, 0, Time}, 0, 500}should be{{t0, 0, Time}, 0, 500}? – march Oct 29 '15 at 06:17CandDare reserved symbols in Mathematica. Perhaps first try to just plot the function with a set of parameters first; once you get that working, then try theManipulate. Also,gis undefined! Is it a number or did you mean to put it in as aManipulated variable? Also, your syntax forPiecewiseis wrong. Also, your definitions forv2andh2should look likeh2[t_]andv2[t_]. – march Oct 29 '15 at 06:21Piecewise[{{h2[t], t0 < t}, {v2[t], 0 < t < t0}}]? – march Oct 29 '15 at 06:49I've input values of A,B,C,D,g and the correct value for t0. My calculator gives me the correct value substituting the variables into the mathematica piecewise equation, however mathematica is way off.
– chris493 Oct 29 '15 at 13:37Logis the natural (Euler's) logarithm, correct? Many other systems have this as the base-10 logarithm. AdditionallyCandDare system symbols and should not be used for your own variables. – Oleksandr R. Oct 29 '15 at 13:40