How can I plot a function with multiple constants?

I have this function

With 3 constants, R, c, and V. The question I have in hand is to show how the solution curve changes as the parameters change so I need to plot this function with several different value of each constant, other than plotting each function many times is there a way to plot this function just once with a slider to be able vary the constants? I tried looking Plot[Table and Manipulate function but that didn't help me a lot. I also tried looking into the plot function. How can I plot this function?

1 Answer

One way might be to use Manipulate

Manipulate[
sol = q[t] /.
First@DSolve[{r q'[t] + q[t]/c == v, q[0] == ic}, q[t], t];
Grid[{{sol},
{Plot[sol, {t, 0, maxT}, PlotRange -> {{0, maxT}, {0, maxQ}},
ImagePadding -> 40, ImageSize -> 300, Frame -> True,
FrameLabel -> {{"q(t)", None}, {"t", "Solution to the problem"}},
GridLines -> Automatic, GridLinesStyle -> LightGray,
PlotStyle -> Red]
}}],

{{c, 1.6, "c"}, 0, 2, .1, Appearance -> "Labeled", ImageSize -> Tiny},
{{r, .1, "r"}, .1, 2, .1, Appearance -> "Labeled", ImageSize -> Tiny},
{{v, 1.5, "c"}, .1, 2, .1, Appearance -> "Labeled", ImageSize -> Tiny},
{{ic, 1, "q[0]"}, 0, 2, .1, Appearance -> "Labeled", ImageSize -> Tiny},
{{maxT, 1, "time scale"}, 1, 100, .1, Appearance -> "Labeled", ImageSize -> Tiny},
{{maxQ, 3, "y scale"}, .1, 10, .1, Appearance -> "Labeled", ImageSize -> Tiny}
]

• For some reason everytime I use the Manipulate function it gives me the definition of the word Manipulate instead, what am I doing wrong? its on Mathematica web – method Apr 19 '17 at 5:49
• @method it is here reference.wolfram.com/language/ref/Manipulate.html I find using google search "Mathematica manipulate" – Nasser Apr 19 '17 at 5:51
• here's what I am getting i.imgur.com/QFvjBsK.png, I have tried to use a function from the reference link and it seemed to work but I tried to hand write the one you gave me too still getting the definition – method Apr 19 '17 at 6:06
• @method I do not use Mathematica online, so I am not sure why it does not work there. so I can't really help on that. I use Wolfram Mathematica desktop (on the PC) not on the cloud one. May be someone else knows why it does not work on Wolfram online. – Nasser Apr 19 '17 at 6:15
• @method In the image you linked that first orange equal sign is suspicious. It means you are calling WolframAlpha and I think you don't need this. I have tried @Nasser Manipulate code in online programing lab and it works. – Pinti Apr 19 '17 at 7:58