in my script,i have defined function current(cur), which is a function of two variables resistance(res) and time(tim). Now what i need that for my function to pick a resistance value(which is a vector) and evaluate the function over a certain range of time and obtain the RMS value of current. then i want to plot these values of current wrt their resistance values?

My program is as shown below:

Rlist = {10^0, 10^1, 10^2, 10^3, 10^4, 10^5, 10^6, 10^7, 10^8, 10^9};
cur[tim_, res_] := sig*(r2^2 - r1^2)*num* omega*(1/2 - Exp[-(tim/(res*capa))]/(1 + Exp[Pi/(num*omega*res*capa)]))   

Pr[res_] := Evaluate@Table[cur[tim, res]^2*res, {tim, 0, (2*Pi)/(num*omega)}, {res, Rlist}];
ListLogLinearPlot[Pr[res],Frame -> True,PlotStyle -> Thickness[0.01],Joined -> True,FrameLabel -> {Style["Load Resistance(\[CapitalOmega])", 16],Style["Average Power", 16]},FrameTicks -> {Rlist},PlotStyle -> PointSize[0.5]] 

Although the above code is generating a graph, I am not sure whether the obtained graph is wrt resistance, as the axis ticks are integers like 1,2,3,4... and not resistance values as per the list. (all others variables are constants defined earlier).

Kindly let me know whether the obtained graph is wrt resistance values or not?

Regards, Sagar H P


  • $\begingroup$ You did not specify constant values num, omega, capa. $\endgroup$ Commented Oct 29, 2018 at 13:02
  • $\begingroup$ sig*(r2^2 - r1^2)=? $\endgroup$ Commented Oct 29, 2018 at 13:08

2 Answers 2


Put sig*(r2^2 - r1^2)=1,num = 1; omega = 1; capa = 1; then

Rlist = {10^0, 10^1, 10^2, 10^3, 10^4, 10^5, 10^6, 10^7, 10^8, 10^9};
cur[tim_, res_] := 
 num*omega*(1/2 - 
    Exp[-(tim/(res*capa))]/(1 + Exp[Pi/(num*omega*res*capa)]))

Pr = Table[{res, cur[tim, res]^2*res}, {tim, 
    0, (2*Pi)/(num*omega)}, {res, Rlist}];
ListLogLinearPlot[Pr, Frame -> True, PlotStyle -> Thickness[0.01], 
 Joined -> True, 
 FrameLabel -> {Style["Load Resistance(\[CapitalOmega])", 16], 
   Style["Average Power", 16]}, FrameTicks -> {Rlist}, 
 PlotStyle -> PointSize[0.5], PlotRange -> All]



@GerardF123 & @Alex Trounev, thank you for your time. I actually wanted to Plot the graph of RMS value of current in time domain wrt each resistance values and i implemented it as below.

data = Evaluate@ Table[{res, RootMeanSquare[Table[cur[tim, res]^2*res, {tim, 0, (2*Pi)/(num*omega)}]]}, {res,Rlist}]

I basically defined another table inside a table and constructed the graph. Thank you for your time :)

  • $\begingroup$ Just a heads up... It is considered best practice to update your original post with your new findings/attempts instead of answering your own question. The only time you would answer your own question is if you found the best solution yourself and you want document it. Generally in those cases you would also let people know who gave you the suggestions in they are in other's answers. $\endgroup$
    – kickert
    Commented Oct 30, 2018 at 18:31
  • $\begingroup$ Sure. Ill keep that in mind :) $\endgroup$
    – Sagar Hp
    Commented Oct 30, 2018 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.