# Plot a function with different values of a parameter on the same plot

I want to plot the following function with different values of the parameter $b$:

a = -0.1 Sqrt[0.001^2 + b^2];

M[t_] := NIntegrate[10w E^(-w/50)((1-Cos[(w+a)t])/(w+a)^2),{w,0,-a,∞},
MaxRecursion -> 100, AccuracyGoal -> 10, Method -> "PrincipalValue"]

Plot[M[t],{t,0,1000}]

How can I code different plots for different values of parameter $b$ in a single plot?

Note: My actual code is pretty bigger than this. So I cannot define a new series of variables and functions for each value of the parameter and then plot them simultaneously.

• M[t_, b_] := With[{a = -0.1 Sqrt[0.001^2 + b^2]}, (* stuff *)], then use Table[] within Plot[]. – J. M.'s discontentment Jul 29 '16 at 6:06
• @J.M Thanks man. But can you elaborate on that? – New Developer Jul 29 '16 at 6:30

Following J.M.'s comment (his credit)

M[t_, b_] :=  With[{a = -0.1 Sqrt[0.001^2 + b^2]},
NIntegrate[10 w E^(-w/50) ((1 - Cos[(w + a) t])/(w + a)^2), {w,
0, -a, ∞}, MaxRecursion -> 100, AccuracyGoal -> 10,
Method -> "PrincipalValue"]]

Then

Plot[ Table[M[t, b], {b, 1, 2}]//Evaluate, {t, 0, 1}]

• Suggest you put Evaluate round the table to see the curves in different colours – mikado Jul 29 '16 at 8:06
• its done thanks! – chris Jul 29 '16 at 8:17

Check this formalism. It works.

mList = {1, 3, 4, 6};

Plot[Table[m x, {m, mList}] // Evaluate, {x, 0, 10},
PlotLegends -> mList]