# How can I include a parameter in ListPlot?

**URL:** <https://community.wolfram.com/t/how-can-i-include-a-parameter-in-listplot/3172>\
**Category:** Questions\
**Tags:** computer-science, data-science, education, engineering, mathematica, equation-solving, numerical-computation\
**Created:** [September 3, 2014, 11:14am UTC](https://community.wolfram.com/t/how-can-i-include-a-parameter-in-listplot/3172 "2014-09-03T11:14:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![plevriev](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@plevriev](https://community.wolfram.com/u/plevriev)\
**Post date:** [September 3, 2014, 11:14am UTC](https://community.wolfram.com/t/how-can-i-include-a-parameter-in-listplot/3172/1 "2014-09-03T11:14:39Z")

</div>

How can I include in my following `ListPlot` command that I want `theta` to have the values 0, 22.5, 45, 67.5 and 90?

```
Ks[theta_?NumericQ]:=Table[{A,NIntegrate[x f2[A,x],{x,0,1}]},{A,{0,0.05,0.15,0.25,6}}];
ListPlot[Re[Ks],Joined->True,PlotRange->{{0,6},{-0.2,0.8}},Frame->True]

```

I basically want to plot the result of a numerical integration where x axis is A and y axis is Ks(A) for these 5 theta parameter values, meaning I want to have five lines in the plot.

To define `f2` I have used this code [http://mathematica.stackexchange.com/questions/11594/integral-equation-numerical-solution-with-ndsolve](http://mathematica.stackexchange.com/questions/11594/integral-equation-numerical-solution-with-ndsolve). My complete algorithm is:

```
Options[FredholmKind2]={Method->Automatic};
FredholmKind2[{a_,b_,lambda_,k_,g_},n_?IntegerQ,OptionsPattern[]]:=Block[{step,SI,GI,KMatrix,W,DMatrix,f,deltaX,delta},step=(b-a)/n;
  SI=Range[a,b,step];
  GI=g/@SI;
  KMatrix=Outer[k,SI,SI];
  W={step/2}~Join~ConstantArray[step,n-1]~Join~{step/2};
  DMatrix=DiagonalMatrix[W];
  f=If[OptionValue[Method]===NIntegrate,deltaX[x_?NumericQ]:=W.(k[x,#]&/@SI)-NIntegrate[k[x,y],{y,a,b}];
    delta=deltaX/@SI;
    Interpolation[Transpose@{SI,LinearSolve[IdentityMatrix[n+1]+lambda*(DiagonalMatrix[delta]-KMatrix.DMatrix),GI]}],
    Interpolation[Transpose@{SI,LinearSolve[IdentityMatrix[n+1]-lambda*(KMatrix.DMatrix), I]}]];
  f]

n=50;
a=0.;
b=1.;
lambda=-1.;
Kpart[A_?NumericQ][x_,y_]:=(A/2)*(BesselJ[1,A*(x+y)]-BesselJ[1,A*Abs[x-y]]-I*StruveH[1, A*(x+y)]+I*StruveH[1,A*Abs[x-y]]);
Gpart[A_?NumericQ,theta_?NumericQ][x_]:=Sin[x A Cos[theta Degree] Degree]/(A Cos[theta Degree]);
f2[A_?NumericQ,x_?NumericQ]:=FredholmKind2[{a,b,lambda,Kpart[A],Gpart}, n,Method->Automatic][x];
Ks=Table[{A,NIntegrate[x f2[A,x],{x,0,1}]},{A,0,6,.1}];
ListPlot[Re[Ks],Joined->True,PlotRange->{{0,6},{-0.2,0.8}},Frame -> True]

```

---

<div class="post-metadata">

**Author:** ![skinnerd](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/skinnerd/32/5926_2.png) [@skinnerd](https://community.wolfram.com/u/skinnerd)\
**Post date:** [September 3, 2014, 3:07pm UTC](https://community.wolfram.com/t/how-can-i-include-a-parameter-in-listplot/3172/2 "2014-09-03T15:07:04Z")

</div>

You have _theta_ as an argument for the function _Ks_ but I don’t see it referenced in the function’s definition.

If all you want to do is to plot the function for different values of _th_ (_theta_) then something like this would work,

```
ListPlot[Table[f[th],{th,{0, 22.5, 45, 67.5, 90}}],Joined->True,PlotRange->{{a,b},{c,d}},Framed->True]

```

`f[th]` will be a function that produces a discrete set of points for each value of `th`.
