[pstricks] Function of the current in a coil

Thomas Söll 1und1 Thomas.Soell at onlinehome.de
Wed Feb 23 22:42:41 CET 2011


Hallo,

I want to draw the current through a coil. The example shows my result. It seems to be ok.
The problem comes, if I want to draw the current for parameters where the maximal current is not reached, as shown in the last example.
Then the parts of the function are not continual.

The endpoints should be calculated and this gives the startpoint from the next curve and so on.

Does anybody knows a solution?

Thanks for help

Thomas  \documentclass[a4paper,12pt]{article}\usepackage[T1]{fontenc}\usepackage[latin1]{inputenc}\usepackage{ngerman}\usepackage{fancyhdr}\usepackage{amsmath,amsthm}\usepackage{enumerate}\usepackage{alphalph}\usepackage{calc}         % From LaTeX distribution\usepackage{multido}      % From PSTricks\usepackage{ifthen}       % From LaTeX distribution\usepackage{array}\usepackage[dvips]{graphics}%\usepackage[dvips,usenames,dvipsnames]{xcolor} %% Farben sind im Dokument xcolor.pdf definiert\usepackage[dvips]{changebar}\usepackage{pstricks}\usepackage{pst-plot}\usepackage{pst-node}\usepackage{pst-tree}\usepackage{pst-eps}\usepackage{pst-ghsb}\usepackage[tiling]{pst-fill}\usepackage{pst-text}\usepackage{pst-blur}%\usepackage{pst-all}\usepackage{pst-osci,pst-circ}\usepackage{pst-poly}     % From pstricks/contrib/pst-poly\usepackage{pst-optic}\usepackage{pst-eucl}\usepackage{pst-math}\usepackage{pst-func}%\usepackage{pst-3dplot}\usepackage{pst-electricfield}\usepackage{pstricks-add}%\input{dokdef0} \begin{document}\section*{Selbstinduktion}%\begin{pspicture}(-6,-1)(4,5)\newpsstyle{Red}{plotstyle=line,linecolor=red,linewidth=0.15,plotpoints=2500}\newpsstyle{Blau}{plotstyle=line,linecolor=blue,linewidth=0.15,plotpoints=2500}\newpsstyle{Green}{plotstyle=line,linecolor=green,linewidth=0.15,plotpoints=2500}%\psgrid[subgriddiv=5,gridcolor=lightgray,griddots=10,gridlabels=10pt](-4,-1)(4,5)\pnode(0,0){A}\pnode(0,4){B}\pnode(4,4){C}\pnode(4,0){D}\pnode(-3,0){E}\pnode(-3,4){F}% Dipole node connection\transformer[primarylabel=$n_1$,secondarylabel=$n_1$,arrows=-o,arrowscale=1.7](B)(A)(C)(D){}% Wire to complete circuit\wire[arrows=o-,arrowscale=1.7](F)(B)%\resistor[labeloffset=0,arrows=o-,arrowscale=1.7](E)(1,4|E){$R$}%\rput(4.5,1.9){% \psscalebox{0.2}{%  \Oscillo[amplitude1=-3.5,phase1=90,period1= 2E30,damping1=0.02,plotstyle1=Green]}}%\rput(-0.6,1.4){% \psscalebox{0.15}{%  \Oscillo[amplitude1=0,offset2=3,amplitude2=-3,period2= 2E31,damping2=0.02,phase2=90,plotstyle2=Blau]}}\rput(-2.8,2.0){% \psscalebox{0.15}{%  \Oscillo[ Wave1= \RectangleA,period1=25,amplitude1=1,offset1=1,plotstyle1=Red]}}%\wire(A)(B)\qdisk(A){2pt}\qdisk(-2,0){2pt}\pnode(-2,0){M}\pnode(4.18,1.0){G} \ncangles[angleA=0, armA=1.7cm,angleB=-90,linearc=0.2]{-o}{C}{G}\pnode(4,1.0){H} \nccurve[angleA=90,angleB=-90]{-o}{D}{H}\pnode(-0.85,0.73){I} \nccurve[angleA=90,angleB=-90,arrowscale=.85]{-o}{A}{I}\pnode(-1.05,0.73){J} \nccurve[angleA=90,angleB=-90,arrowscale=.85]{-o}{M}{J}\pnode(-3.3,1.33){K} \ncangles[angleA=180, armA=.8cm,angleB=-90,linearc=0.2,arrowscale=.85]{-o}{F}{K}\pnode(-3.1,1.33){L} \nccurve[angleA=90,angleB=-90,arrowscale=.85]{-o}{E}{L}\end{pspicture} \begin{center}\begin{pspicture}(-1,-1)(12,5) \psframe*[linecolor=green!20](-0.8,-0.8)(12.5,4.6) \psframe*[linecolor=white](0,0)(12,4.0) \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0,xunit=1,yunit=1.333](0,0)(11.5,3.0)\psset{xAxisLabel=$t$, yAxisLabel=$U$,arrowscale=2}\begin{psgraph}{->}(0,-0.5)(12,1.0){12cm}{4cm}\makeatletter\psplot[plotpoints=20,linecolor=red,linewidth=2pt]{0}{11.5}  [ /yMax 0.5 def /T0 2 def /T1 T0 def ]% <=== this is new !!!!  { x T1 gt {      T1 yMax \tx at ScreenCoor      2 copy 4 2 roll L neg L      /yMax yMax neg def /T1 T1 T0 add def } if yMax }  \end{psgraph}\end{pspicture}\end{center}\begin{center}\begin{pspicture}(-1,-0.5)(12,4) \psframe*[linecolor=green!20](-0.8,-0.5)(12.5,4.6)% \psframe*[linecolor=white](0,0)(12,4) \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0](0,0)(12,4)\psset{xAxisLabel=$t$, yAxisLabel=$I$,arrowscale=2}\def\R{120}%    Widerstand\def\L{0.16}%   Induktivität\def\t{0.004}%    Zeitkonstante\def\A{1}%     Amplitude\begin{psgraph}{->}(0,0)(0,-.5)(12,1.5){12cm}{4cm}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{0}{2}  {\A*(1-2.7182818^(-x*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{4}{6}  {\A*(1-2.7182818^(-(x-4)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{8}{10}  {\A*(1-2.7182818^(-(x-8)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{2}{4}  {\A*2.7182818^(-(x-2)*\t*\R/\L)}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{6}{8}  {\A*2.7182818^(-(x-6)*\t*\R/\L)}  \psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{10}{11.5}  {\A*2.7182818^(-(x-10)*\t*\R/\L)}  \end{psgraph}\end{pspicture}\end{center}\begin{center}\begin{pspicture}(-1,-1)(12,6) \psframe*[linecolor=green!20](-0.8,-0.4)(12.5,6.8) \psframe*[linecolor=white](0,0)(12,6) \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0](0,0)(12,6)\psset{xAxisLabel=$t$, yAxisLabel=$U_{\text{ind}}$,arrowscale=2}\def\R{120}%    Widerstand\def\L{0.16}%   Induktivität\def\t{0.004}%  Zeitkonstante\def\A{1}%     Amplitude\def\B{1}%     Amplitude\begin{psgraph}{->}(0,0)(0,-1.5)(12,1.5){12cm}{6cm}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=5,yMinValue=-2]{0}{2}  {\A*(-2.7182818^(-x*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=5,yMinValue=-2]{4}{6}  {\A*(-2.7182818^(-(x-4)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=5,yMinValue=-2]{8}{10}  {\A*(-2.7182818^(-(x-8)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=1.5,yMinValue=-2]{2}{4}  {\B*2.7182818^(-(x-2)*\t*\R/\L)}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=1.5,yMinValue=-2]{6}{8}  {\B*2.7182818^(-(x-6)*\t*\R/\L)}  \psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=green,yMaxValue=1.5,yMinValue=-2]{10}{11.5}  {\B*2.7182818^(-(x-10)*\t*\R/\L)}%  \psline[linewidth=1pt,linecolor=blue](2,0)(2,1.5)%%  \psline[linewidth=1pt,linecolor=blue](6,0)(6,1.5)%%  \psline[linewidth=1pt,linecolor=blue](10,0)(10,1.5)%  \end{psgraph}\end{pspicture}\end{center}\begin{center}\begin{pspicture}(-1,-0.5)(12,4) \psframe*[linecolor=green!20](-0.8,-0.5)(12.5,4.6)% \psframe*[linecolor=white](0,0)(12,4) \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0](0,0)(12,4)\psset{xAxisLabel=$t$, yAxisLabel=$I$,arrowscale=2}\def\R{120}%    Widerstand\def\L{0.5}%   Induktivität\def\t{0.004}%    Zeitkonstante\def\A{1}%     Amplitude\begin{psgraph}{->}(0,0)(0,-.5)(12,1.5){12cm}{4cm}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{0}{2}  {\A*(1-2.7182818^(-x*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{4}{6}  {\A*(1-2.7182818^(-(x-4)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{8}{10}  {\A*(1-2.7182818^(-(x-8)*\t*\R/\L))}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{2}{4}  {\A*2.7182818^(-(x-2)*\t*\R/\L)}\psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{6}{8}  {\A*2.7182818^(-(x-6)*\t*\R/\L)}  \psplot[linewidth=1pt,algebraic=true,plotpoints=500,linecolor=blue,yMaxValue=5,yMinValue=-2]{10}{11.5}  {\A*2.7182818^(-(x-10)*\t*\R/\L)}  \end{psgraph}\end{pspicture}\end{center}\end{document} 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20110223/5a0088f1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Induktion-1.pdf
Type: application/pdf
Size: 119471 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20110223/5a0088f1/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Induktion-1.tex
Type: application/octet-stream
Size: 7511 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20110223/5a0088f1/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Spule-Magnetfeld-Induktion.pdf
Type: application/pdf
Size: 117701 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20110223/5a0088f1/attachment-0003.pdf>


More information about the PSTricks mailing list