# Why isn't my plot displaying properly? (Exponential Decay Plot)

I'm working on a demonstration for radioactive decay of the form Nt=N0*e^-kt. Users can input values for k and N0 using sliders, and the plot will automatically adjust the scale of the x and y axes to fit the data. That automatic adjustment seems to be working well, but the graph doesn't appear to be showing up for some reason. Does anybody know why? I'm relatively new to Mathematica so I may be missing something simple, but I haven't been able to find anything online about this and the program isn't throwing any error messages.

Code:

    (*Methdology for altering scale of graph axes*)

(*Define general form of function and constants*)
exponentialDecay[t_] = nZero*Exp[-k*t];
nZeroMin = 10^7;
nZeroMax = 10^10;
kMin = 10^-10;
kMax = 3*10^-6;

(*Create a manipulable exponential decay function*)
Manipulate[
Plot[
exponentialDecay,
{t, 0, 2.3/k}, PlotRange -> {{0, 2.3/k}, {0, nZero}}],
Control[{{nZero, 1000000000, "Initial Number of Atoms"}, nZeroMin,
nZeroMax}],
Control[{{k, 0.0000001, "k Value"}, kMin, kMax}]
]


Image of output:

• Edit: I've solved the problem. I forgot to include N0 and k as arguments of the decay function so they can be called when plotting it. Leaving this up in case anybody googles a similar issue. Feb 18, 2023 at 20:58

Clear["Global*"]

(*Methdology for altering scale of graph axes*)
(*Define general form of function and constants*)
exponentialDecay[t_] = nZero*Exp[-k*t];
nZeroMin = 10^7;
nZeroMax = 10^10;
kMin = 10^-10;
kMax = 3*10^-6;


The control variables are local to the Manipulate, i.e., different from the external variables. Also, since Plot has the attribute HoldAll, the arguments need to be evaluated before Plot can use them. One approach is to replace the external variables and Apply the Plot

(*Create a manipulable exponential decay function*)
Manipulate[
Plot @@ ({exponentialDecay[t], {t, 0, 2.3/k},
PlotRange -> {{0, 2.3/k}, {0, nZero}}} /.
{k -> kVal, nZero -> nZeroVal}),
{{nZeroVal, 1000000000., "Initial Number of Atoms"},
nZeroMin, nZeroMax, Appearance -> "Labeled"},
{{kVal, 0.0000001, "k Value"}, kMin, kMax,
Appearance -> "Labeled"}]
`