# 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[]. Jul 29, 2016 at 6:06
• @J.M Thanks man. But can you elaborate on that? Jul 29, 2016 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 Jul 29, 2016 at 8:06
• its done thanks! Jul 29, 2016 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]