Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University Patiala – 147 002 PART IX- Computer Simulation RC - Circuit LR-Circuit.

Similar presentations


Presentation on theme: "MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University Patiala – 147 002 PART IX- Computer Simulation RC - Circuit LR-Circuit."— Presentation transcript:

1 MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University Patiala – PART IX- Computer Simulation RC - Circuit LR-Circuit LC-Circuit: Harmonic Oscillations LCR-Circuit: Damped Oscillations Nonlinearity: Rectifier’s Output Resonance in Driven LCR Circuit

2 Charging and Discharging Capacitor (RC – Circuit )

3 Equations of Motion Kirchoff's loop law gives:

4 RC- Circuit Clear["Global`*"] r = 0.85; c = 1.2; (* inputs:- R & C *) v= 0.1; q0=0; (* voltage applied & initial charge *) tmin = 0; tmax = 5; ndsol = NDSolve[ Join[ {r q'[t]+q[t]/c -v==0}, {q[0]==q0}], q[t], {t, tmin, tmax} ] Plot[ q[t]/.ndsol, {t, tmin, tmax}, PlotLabel->"Charging of a Capacitor", AxesLabel->{"t", "q"} ]

6 RC- Circuit: Charge and Current Clear["Global`*"] r = 0.85; c = 1.2; (* R & C *) v= 0.1; q0=0;(* voltage applied & initial charge *) tmin = 0; tmax = 5; dsol = DSolve[ Join[ {r q'[t]+q[t]/c -v==0}, {q[0]==q0}], q[t], t ]//Flatten Plot[ q[t]/.dsol, {t, tmin, tmax}, PlotLabel->"Charging of a Capacitor", AxesLabel->{"t", "q"} ] i[t_]= D[ q[t]/.dsol, t] Plot[ i[t], {t, tmin, tmax}, PlotLabel->"Current while charging a Capacitor", AxesLabel->{"t", "i"} ]

8

9 RC- Circuit: Resistance changes with time Clear["Global`*"] r=0.85; res[t_]:= r*(1+0.8*t) c = 1.2; (* R & C *) v= 0.1; q0=0;(* voltage applied & initial charge *) tmin = 0; tmax = 8; ndsol = NDSolve[ Join[ {r*q'[t]+q[t]/c -v==0}, {q[0]==q0}], q[t], {t, tmin, tmax}] ndsol1 = NDSolve[ Join[ {res[t]*qv'[t]+qv[t]/c -v==0}, {qv[0]==q0}], qv[t], {t, tmin, tmax}] i[t_]= D[ q[t]/.ndsol, t] iv[t_]= D[ qv[t]/.ndsol1, t] Plot[ {q[t]/.ndsol, qv[t]/.ndsol1}, {t, tmin, tmax}, PlotLabel->"Charging of a Capacitor", AxesLabel->{"t", "q"}, PlotStyle-> {Dashing[{}], Dashing[{0.02}]} Plot[ {i[t], iv[t]}, {t, tmin, tmax}, PlotLabel->"Current while charging a Capacitor", AxesLabel->{"t", "i"}, PlotStyle-> {Dashing[{}], Dashing[{0.02}]} ]

10

11

12 Growth of Current in RL – Circuit

13 RL- Circuit Clear["Global`*"] r = 0.85; ind = 1.2; (* R & L *) v= 0.1; i0=0; (* voltage applied & initial current *) tmin = 0; tmax = 5; dsol = DSolve[ Join[ { i'[t]+i[t]*r/ind -v/ind==0}, {i[0]==i0}], i[t], t]//Flatten Plot[ i[t]/.dsol, {t, tmin, tmax}, PlotLabel->"Current in RL Circuit", AxesLabel->{"t", "i"}]

14

15 RL- Circuit: Energy Analysis Clear["Global`*"] r = 0.85; ind = 1.2; (* R & L *) v= 0.1; i0=0;(* voltage applied & initial current *) tmin = 0; tmax = 5; ndsol = NDSolve[ Join[ { i'[t]+i[t]*r/ind -v/ind==0}, {i[0]==i0}], i[t], {t, tmin, tmax}] n=10;h=(tmax-tmin)/n//N; Print["Energy Analysis in RL Circuit"] Print["time in L in R in R+L Supplied"] Do[ energy=v*NIntegrate[ Evaluate[i[t]/.ndsol], {t, tmin, tup}] ; indener= 0.5*ind*((i[t]/.ndsol/.t->tup)^2-(i[t]/.ndsol/.t->tmin)^2); resener= r*NIntegrate[ Evaluate[(i[t]/.ndsol)^2],{t, tmin, tup}]; Print[tup," ",indener," ",resener," ",indener+resener," ",energy], {tup, tmin, tmax, 0.5} ]

17 RL- Circuit: Resistance changes with time Clear["Global`*"] r = 0.85; ind = 1.2; (* R & L *) v= 0.1; i0=0;(* voltage applied & initial current *) tmin = 0; tmax = 5; res[t_]:= r*(1+0.8 *t) ndsol = NDSolve[ Join[ { i'[t]+i[t]*r/ind -v/ind==0}, {i[0]==i0}], i[t], {t, tmin, tmax}]//Flatten ndsol1 = NDSolve[ Join[ { iv'[t]+iv[t]*res[t]/ind -v/ind==0}, {iv[0]==i0}], iv[t], {t, tmin, tmax}]//Flatten Plot[ {i[t]/.ndsol, iv[t]/.ndsol1}, {t, tmin, tmax}, PlotLabel->"Current in RL Circuit", AxesLabel->{"t", "i"}, PlotStyle->{Dashing[{}],Dashing[{0.02}] }]

18

19 LC- Circuit: Harmonic Oscillations

20

21 LC- Circuit Clear["Global`*"] ind = 1.2;cap=0.85; (* L C *) i0=1.0;q0=1.0;(* initial conditions *) tmin = 0; tmax = 15; dsol = DSolve[ Join[ { q''[t]+ q[t]/(ind*cap)==0}, {q[0]==q0, q'[0]==i0}], q[t], t]//Flatten//Chop i[t_]=D[ q[t]/.dsol, t] Plot[ {q[t]/.dsol, i[t]}, {t, tmin, tmax}, PlotLabel->"Oscillations in LC-Circuit", AxesLabel- >{"t", "q"}, PlotStyle->{Dashing[{}], Dashing[{0.01}]}, PlotPoints->50 ] Print[" "] Print[" Energy Analysis in LC Circuit"] Print[" in L in C total"] Print[" "] Do[ indener = 0.5*ind*i[t]^2; capener = 0.5*(q[t]/.dsol)^2/cap; Print[ indener," ",capener," ",indener+capener], {t, tmin, tmax, 1.0} ] Print[" "]

22 {q[t]®1. Cos[ t] Sin[ t]}

23 Energy Analysis in LC Circuit in L in C total

24 LCR-Circuit: Damped Oscillations

25

26 LCR- Circuit Clear["Global`*"] ind = 1.2;cap=0.85;res=0.5; (* L C R *) i0=1.0;q0=1.0;(* initial conditions *) tmin = 0; tmax = 15; dsol = DSolve[ Join[ { q''[t]+q'[t]*res/ind+ q[t]/(ind*cap)==0}, {q[0]==q0, q'[0]==i0}], q[t], t ]//Flatten i[t_]=D[ q[t]/.dsol, t] Plot[ {q[t]/.dsol, i[t]}, {t, tmin, tmax}, PlotLabel->"Damped Oscillations in LCR-Circuit", AxesLabel->{"t", "q & i"}, PlotStyle->{Dashing[{}], Dashing[{0.01}]}, PlotPoints->50 ]

27 {q[t]®ã( t (1. Cos[ t] Sin[ t])}

28 LCR- Circuit: time-varying resistance Clear["Global`*"] ind = 1.2;cap=0.85;res=0.02; (* L C R *) r[t_]:= res*(1+0.3*t^2) i0=1.0;q0=1.0;(* initial conditions *) tmin = 0; tmax = 25; dsolv = NDSolve[ Join[ { q''[t]+q'[t]*r[t]/ind+ q[t]/(ind*cap)==0}, {q[0]==q0, q'[0]==i0}], q[t], {t, tmin, tmax}]//Flatten p1= Plot[ {q[t]/.dsolv}, {t, tmin, tmax}, PlotLabel->"Time Varying R in LCR-Circuit: ", AxesLabel->{"t", "q"}, PlotStyle->{ Dashing[{0.01}]}, PlotPoints->50 ]; dsol = NDSolve[ Join[ { q''[t]+q'[t]*res/ind+ q[t]/(ind*cap)==0}, {q[0]==q0, q'[0]==i0}], q[t], {t, tmin, tmax}]//Flatten p2 = Plot[ {q[t]/.dsol}, {t, tmin, tmax}, AxesLabel->{"t", "q"}, PlotPoints->50 ]; Show[p1, p2]

29

30 Nonlinearity : Rectifier's Output Clear["Global`*"] w= 2.0; tmin = 0; tmax = 6; eps = 1.1; v[t_]:= Sin[w*t] Plot[ v[t], {t, tmin, tmax}, PlotLabel -> "Input Signal", AxesLabel->{"t", "v"}] Plot[ v[t]+eps*v[t]^2, {t, tmin, tmax}, PlotLabel -> "Output Signal", AxesLabel->{"t", "v"}]

31

32 Nonlinear Circuit

33 r = 100.0; k = 1.39*10^(-23); t = 300; q = 1.6*10^(-19); i0 = 10^(-10); v1= 15.0; FindRoot[{(v1-v2)/r == i0*(E^(q*v2/(k*t))-1)}, {v2, 0.5}] v1= 15.1; FindRoot[{(v1-v2)/r == i0*(E^(q*v2/(k*t))-1)}, {v2, 0.5}] {v2 -> } {v2 -> }

34 Resonance in Driven LC Circuit

35 Eqns. for time dependent Voltage

36 Steady State for w Clear["Global`*"] dsol = Solve[{v1*E^(I w t)-v2*E^(I w t)== i0*r*E^(I w t), i0== i1+i2, c*D[v2*E^(I w t), t]==i1*E^(I w t), l*D[i2*E^(I w t), t]==v2*E^(I w t)}, {v2, i0, i1, i2}] Simplify[dsol] c = 10^(-6); l = 10^(-3); v1=1; Plot[Release[Table[Abs[v2]/.dsol[[1]]/.r->10^n, {n,2,4,0.5}]], {w, 20000, 40000}, PlotRange -> {0,1}]

37

38

39 Thank You


Download ppt "MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University Patiala – 147 002 PART IX- Computer Simulation RC - Circuit LR-Circuit."

Similar presentations


Ads by Google