! x" + bx' + kx = 0 ! s^2 + bs + k = 0 ! -b +-sqrt(b^2 - 4k) / 2 ! discriminant = b^2 - 4k ! b = sqrt(4k) then there is one real root and critical damping ! b > sqrt(4k) then the roots are real and it is overdamped ! b < sqrt(4k) then the roots are complex and it is underdamped ! Damped Vibes: Rather than just a rollover vertical line, let's have crosshairs, ! parallel with Damping Constant. Also in parallel, let's switch to scale buttons ! .01, .1, 1, 10, and eliminate the "maximum x" text. ! Damped Vibrations ! ! Set the initial conditions on the window at left or using the sliders. ! ! Set the spring constant k and the damping constant b using the sliders ! at lower left. ! ! Buttons control the vertical scale of the right hand graphing window. ! The solution is displayed in blue on that window. ! Crosshairs show when you roll the cursor over the right hand window, ! and the values of t and x are displayed. ! Critical Damping is the least amount of damping required to ! return a system to its equilibrium state without oscillation. ! Dennis Zill on damping ! mx'' + Bx' + kx = 0 where B is a positive damping constant ! x'' + B/m x' + k/m x = 0 ! or ! x'' + 2Z x' + w^2 x = 0 where 2Z = B/m and w^2 = k/m ! engineers call this w the natural frequency, w_n ! 2Z is used for convenience to make the auxiliary equation ! m^2 + 2Zm + w^2 = 0 ! the roots of this equation are ! m1 = (-2Z + sqrt((2Z)^2 - 4w^2)) / 2 ! m2 = (-2Z - sqrt((2Z)^2 - 4w^2)) / 2 ! m1 = (-2Z + sqrt(4Z^2 - 4w^2)) / 2 ! m2 = (-2Z - sqrt(4Z^2 - 4w^2)) / 2 ! m1 = (-2Z + 2sqrt(Z^2 - w^2)) / 2 ! m2 = (-2Z - 2sqrt(Z^2 - w^2)) / 2 ! m1 = -Z + sqrt(Z^2 - w^2) ! m2 = -Z - sqrt(Z^2 - w^2) ! Z = B/(2m) and w = sqrt(k/m) ! if Z^2 = w^2 damping is critical ! if Z = w damping is critical ! if B/2m = sqrt(k/m) damping is critical ! if B = 2m sqrt(k/m) damping is critical ! x'' + B/m sqrt(k/m) x' + k/m x = 0 ! w_n = sqrt(k/m) ! B/m sqrt(k/m) = 0 !! File: DampedVibrations.68k !! June 6, 2003 Hubert Hohn PUBLIC PCFlag,Mac5Flag,M68KFlag,UnixFlag,xmax,ymax PUBLIC toolLft,toolRgt,toolBas,toolTop,toolhdr,toolHgt,toolWid ! tool boundaries PUBLIC winLft,winRgt,winBas,winTop,winHgt,winWid ! window PUBLIC workLft,workRgt,workBas,workTop,workMidx ! work area PUBLIC backclr,black,drkgry,drkmid,midgry,litmid,litgry,white PUBLIC red,yellow,green,cyan,blue,magenta,pink,colorscheme PUBLIC planeclr,gridclr,rimclr,axisclr,axislabelclr,titleclr,rightsclr PUBLIC numberlineclr,slotdrkclr,slotlgtclr,slideclr PUBLIC largefonts, title$, SLUmode LET toolHgt= 560 LET toolWid= 800 LET window$= "The d'Arbeloff Interactive Math Project" LET colorscheme= 0 LET title$ = "Damped Vibrations" SUB ThisProgram CALL InitialConditions CLEAR END SUB !! ------------------------------------------- !! ------ Start TB4 Mac Header and Subs ------ !LET M68KFlag = 1 !LIBRARY "MacTools*", "HHLib.trc" !ASK PIXELS winWid,winHgt !LET winLft= 0 !LET winTop= 0 !LET winRgt= winWid-1 !LET winBas= winHgt-1 !SET WINDOW 0,winRgt,winBas,0 !CALL Palette !CLEAR ! !CALL ToolPanel !CALL ThisProgram ! !END !EXTERNAL ! !MODULE Mac4Parts ! SUB SetTextFont(font,size,style$) ! CALL MacTextFont(font) ! CALL MacTextSize(size) ! CALL MacTextFace(style$) ! END SUB ! ! SUB StringWidth(sw$,sl) ! DECLARE DEF MacStringWidth ! LET sl= MacStringWidth(sw$) ! END SUB ! ! SUB SetLineWeight(wgt) ! CALL MacPenSize(wgt,wgt) ! END SUB ! ! SUB BoxDisk(Lft,Rgt,Bas,Top) ! CALL MacPaintOval(Lft,Rgt,Bas,Top) ! END SUB !END MODULE !! --- End TB4 Mac Header and Subs --- !!--------------------------------------------------------- !!--- Start TB5 Cross-Platform header and subs --- LIBRARY "c:\TB Gold 51a\TBLibs\TrueCtrl.trc" ! windows LIBRARY "c:\TB Gold 51a\TBLibs\HHLib.trc" !LIBRARY ":TBLibs:TrueCtrl.trc" ! macintosh !LIBRARY "HHLib.trc" PUBLIC WinID DECLARE PUBLIC OBJM_SET,OBJM_SYSINFO LET winHgt= toolHgt LET winWid= toolWid DIM values(1) CALL TC_Init CALL Object(OBJM_SYSINFO,WinID,"MACHINE",system$,values()) IF system$="MAC" then LET Mac5Flag= 1 ELSE IF system$="WIN32" then LET PCFlag = 1 END IF CALL TC_SetUnitsToPixels ! 5.1 and up needs this CALL TC_GetScreenSize(scrnLft,scrnRgt,scrnBas,scrnTop) LET winLft= int((scrnRgt-scrnLft-winWid)/2) LET winRgt= winLft+winWid-1 LET winTop= int((scrnBas-scrnTop-winHgt)/2) + 10 LET winBas= winTop+winHgt-1 CALL TC_Win_Create (WinID,"TITLE",winLft,winRgt,winBas,winTop) LET values(1)= 2 CALL Object(OBJM_SET, WinID, "TYPE", "", values()) IF PCFlag=1 then ! kill dithering LET values(1)= 1 CALL Object(OBJM_SET, WinID, "SOLID MIX", "", values()) END IF LET values(1)= 0 CALL TC_SetRect(WinID,winLft,winRgt,winBas,winTop) CALL TC_Win_SetTitle(WinID,window$) CALL TC_Show(WinID) SET MODE "COLORSTANDARD" ASK PIXELS winWid,winHgt ! must follow set mode LET winLft= 0 LET winTop= 0 LET winRgt= winWid-1 LET winBas= winHgt-1 SET WINDOW 0,winRgt,winBas,0 CALL Palette IF PCFlag=1 then LET values(1)= 0 ! now force solid colors CALL Object(OBJM_SET, WinID, "SOLID MIX", "", values()) CALL TC_Win_RealizePalette(WinID) ! some PCs need this CALL TC_Win_SetFont(WinID,"arial",9,"plain") CALL StringWidth("0",sw) IF sw>7 then LET largefonts=1 else LET largefonts=0 END IF CALL TC_Win_Switch(WinID) CALL ToolPanel CALL ThisProgram CALL SetTextFont(1,12,"bold") ! now shut down and clean up LET quit$= "click the mouse or press a key to close..." CALL PlotTextCJ(workmidx,(workbas+worktop)/2,quit$,yellow) CALL TC_CleanUp END EXTERNAL MODULE TB5Parts SUB StringWidth(sw$,sl) DECLARE PUBLIC WinID LET sl= StrWidth(WinID,sw$) END SUB SUB SetLineWeight(wgt) DECLARE PUBLIC OBJM_SET DECLARE PUBLIC WinID DIM values(1) LET values(1)= wgt CALL Object(OBJM_SET,WinID, "WIDTH", "", values()) END SUB SUB SetTextFont(font,size,style$) DECLARE PUBLIC WinID,Mac5Flag,PCFlag,largefonts IF Mac5Flag=1 then SELECT CASE font CASE 4 LET font$= "Courier" CASE 16 LET font$= "Times" CASE else LET font$= "Geneva" END SELECT ELSE IF PCFlag=1 then IF largefonts=1 then IF size<12 then LET size= 6 ELSE IF size=14 then LET size= 10 ELSE IF size=18 then LET size= 12 ELSE IF size=24 then LET size= 14 ELSE IF size=12 then LET size= 8 ELSE LET size= round(72/96 * size * .8) END IF ELSE IF size<12 then LET size= 7 ELSE IF size=14 then LET size= 12 ELSE IF size=12 then LET size= 9 ELSE IF size=18 then LET size= 14 ELSE IF size=24 then LET size= 18 ELSE LET size= round(72/96 * size) END IF END IF SELECT CASE font CASE 4 LET font$= "Courier New" CASE 16 LET font$= "Times New Roman" CASE else LET font$= "Verdana" END SELECT END IF IF style$= "normal" then LET style$= "plain" CALL TC_Win_SetFont(WinID,font$,size,style$) END SUB SUB BoxDisk(Lft,Rgt,Bas,Top) BOX DISK Lft,Rgt,Bas,Top END SUB END MODULE ! --- End TB5 Cross-platform header and subs --- !! --------------------------------------------------------- !! --- Start Unix Header and Subs --- !LIBRARY "HHLib.trc" !LET UnixFlag= 1 !ASK PIXELS winWid,winHgt !LET winLft= 0 !LET winTop= 0 !LET winRgt= winWid-1 !LET winBas= winHgt-1 !SET WINDOW 0,winRgt,winBas,0 !CALL Palette ! !CALL ToolPanel !CALL ThisProgram ! !END !EXTERNAL ! !MODULE UnixParts ! SHARE CharWidth ! ! SUB SetTextFont(font,size,style$) ! LET font$= "-adobe-courier-" ! IF style$= "normal" then ! LET style$= "medium-r-normal--" ! ELSE ! LET style$= "bold-r-normal--" ! END IF ! IF size=9 then ! LET size$= str$(10) ! ELSE ! LET size$= str$(size) ! END IF ! LET test= SetFont(font$&style$&size$&"*") ! ! IF size=9 then ! LET CharWidth= 6 ! ELSE IF size=12 then ! numeric output - axis labels ! LET CharWidth= 7 ! ELSE IF size=14 then ! rare ! LET CharWidth= 8 ! ELSE IF size=18 then ! rare ! LET CharWidth= 10 ! END IF ! END SUB ! ! SUB StringWidth(sw$,sl) ! string width in pixels ! ! LET sl= StrWidth(sw$) ! LET chars= len(sw$) ! LET sl = chars*CharWidth ! END SUB ! ! SUB SetLineWeight(wgt) ! ! CALL PenSize(wgt,wgt) ! END SUB ! ! SUB BoxDisk(Lft,Rgt,Bas,Top) ! CALL Fill_Circle(Lft,Rgt,Bas,Top) ! END SUB !END MODULE !! ------ End of TB Unix Header and Subs ------ ! ----------------------------------------------------------- ! *** SUB InitialConditions DECLARE PUBLIC black,drkgry,drkmid,midgry,litmid,litgry,white DECLARE PUBLIC red,yellow,green,cyan,blue,magenta DECLARE PUBLIC axislabelclr,slideclr DECLARE PUBLIC workLft,workRgt,workBas,workTop,workMidx DECLARE PUBLIC true,false DECLARE DEF quitWithin,infoWithin ! --- help screen array --- DIM info$(1:8) MAT READ info$ DATA "Damped Vibrations" DATA "" ! DATA "The differential equation is x'' + bx' + kx = 0" ! DATA "The characteristic equation is s^[2] + bs + k = 0" ! DATA "The roots of the characteristic equation are" ! ! DATA "-r1 = -b + sqrt(b^[2]-4k) / 2" ! DATA "-r2 = -b - sqrt(b^[2]-4k) / 2" ! DATA "and the discriminant = b^[2] - 4k." ! DATA "" ! DATA "If b^[2] - 4k = 0, then b = sqrt(4k), and this is called critical damping, or b_[c]. Critical damping is the least amount of damping required to return a system to its equilibrium state without oscillation." ! ! DATA "The ratio b/b_[c] is called the damping ratio. If the damping coefficient b is equal to the critical damping b_[c] the damping ratio is 1." ! DATA "If b > b_[c] the damping ratio is greater than 1 and the vibration is overdamped." ! DATA "If b < b_[c] the damping ratio is less than 1 and the vibration is underdamped." ! DATA "" DATA "Set the initial conditions by clicking or dragging the mouse on the left plane," DATA "or by clicking or dragging the x(0) and x'(0) sliders." DATA "Set the spring constant k and the damping constant b using the sliders at lower left." DATA "Clicking a slider among the tik marks gives values rounded to the nearest tenth." DATA "" DATA "Click the number buttons to reset the vertical scale of the time series plane." DATA "" DATA "Roll the cursor over the time series plane to display crosshairs and the values of t and x." ! Damped Vibrations ! ! Set the initial conditions on the window at left or using the sliders. ! ! Set the spring constant k and the damping constant b using the sliders ! at lower left. ! ! Buttons control the vertical scale of the right hand graphing window. ! The solution is displayed in blue on that window. ! Crosshairs show when you roll the cursor over the right hand window, ! and the values of t and x are displayed. ! Critical Damping is the least amount of damping required to ! return a system to its equilibrium state without oscillation. ! --- color definition and adjustment --- LET pdclr = green LET ivclr = yellow LET fldclr= drkmid LET posclr= yellow LET velclr= litgry !cyan LET trclr = blue LET dmpclr= red SET COLOR MIX(blue) .4,.6,1 ! ---------- Utility functions --- DECLARE DEF clamp,roundn,e ! ---- Functions ---- LET dt= 1/64 DEF dxdt(p,v)= v DEF dvdt(p,v)= -b*v - k*p + cos(omega*t) ! I have three signals in mind ! 0 , cos(omega t) , and sq(omega t) ! There are two basic solutions to the "homogeneous equation" ! x" + bx' + kx = 0 ! y(t) with y(0) = 1 and y'(0) = 0 ! z(t) with z(0) = 0 and z'(0) = 1 SUB SetW(b,k, w) LET w= sqr(abs((b/2)^2 - k)) END SUB SUB SetCritDamp(k,critDamp) LET critDamp = 2 * sqr(k) LET critDamp = sqr(4*k) IF k>0 then LET dampRatio= round(b/critDamp,4) END IF END SUB SUB SetNatFreq(k,natFreq) LET natFreq= sqr(k) END SUB SUB SetD(b,k,omega, D) LET D= (k-omega^2)^2 + omega^2*b^2 END SUB SUB SetRS(b,w, r,s) LET r= -b/2 + w LET s= -b/2 - w END SUB SUB SetVars CALL SetW(b,k, w) ! CALL SetD(b,k,omega, D) CALL SetRS(b,w, r,s) CALL SetCritDamp(k, critDamp) LET b2= b*b LET k4= k*4 END SUB SUB InitialVals(b,k,omega,D, fxp0,dxp0) LET fxp0= (k-omega^2)/D LET dxp0= -(omega^2*b)/D END SUB SUB InitialDifs LET deltax= pos-fxp0 LET deltad= vel-dxp0 END SUB DEF y(t) ! velocity ? ! print b,critDamp IF b>critDamp then LET y= 1/(s-r) * (s*e^(r*t) - r*e^(s*t)) ELSE IF bcritDamp then LET z= -1/(s-r) * (e^(r*t) - e^(s*t)) ELSE IF b0 then LET damp$= using$(t5form$,dampRatio) ELSE LET damp$= "infinite" END IF CALL PlotTextLJ(t5Eqx,t5BasLn2,damp$,t5Clr) IF dampRatio<1 then LET damp$= "underdamped" ELSE IF dampRatio>1 then LET damp$= "overdamped" ELSE LET damp$= "critically damped" END IF IF k=0 then LET damp$= "" IF damp$<>oldDamp$ then LET oldDamp$= damp$ BOX CLEAR t5Lft-2,t5Rgt,t5BasLn3+5,t5BasLn3-15 CALL PlotTextLJ(t5Lft,t5BasLn3,damp$,t5Clr) END IF END SUB SUB t5ClearVal BOX CLEAR t5eqx-6,t5Rgt,t5Bas,t5Top END SUB SUB t5Clear BOX CLEAR t5Lft-2,t5Rgt,t5Bas,t5Top END SUB SUB t5Init CALL t5Label CALL t5Value END SUB ! --- text rectangle 3 --- LET t3BasLn1 = w1Bas+62 LET t3BasLn2 = t3BasLn1+20 LET t3Lft = w2Lft !+ 115 LET t3Rgt = t3Lft + 99 LET t3Top = t3BasLn1 - 15 LET t3Bas = t3BasLn2 + 5 LET t3Label1$= "x(0) = " ! x LET t3Label2$= "x(0) = " ! x' CALL SetTextFont(1,12,"bold") CALL StringWidth(t3Label1$,sw) LET t3eqx = t3Lft+sw LET t3form$ = "-%.##" CALL StringWidth(t3form$,sw) LET t3tRgt= t3eqx + sw SUB t3Label CALL SetTextFont(1,12,"bold") CALL PlotTextRJ(t3eqx,t3BasLn2,t3Label1$,posclr) CALL PlotTextRJ(t3eqx,t3BasLn1,t3Label2$,velclr) CALL PlotTextCJ(t3Lft+4,t3BasLn1-10,".",velclr) END SUB SUB t3Set CALL SetTextFont(1,12,"bold") CALL t3ClearVal CALL PlotTextRJ(t3tRgt,t3BasLn2,using$(t3form$,pos),posclr) CALL PlotTextRJ(t3tRgt,t3BasLn1,using$(t3form$,vel),velclr) END SUB SUB t3Clear BOX CLEAR t3Lft-2,t3Rgt,t3Bas,t3Top END SUB SUB t3ClearVal BOX CLEAR t3eqx-6,t3Rgt,t3Bas,t3Top END SUB SUB t3Init CALL t3Label CALL t3Set END SUB ! ------ t4 text output - initial values ------- CALL SetTextFont(1,12,"bold") LET t4BasLn1 = w1Bas+62 LET t4BasLn2 = t4BasLn1+20 CALL StringWidth("x = 55.55555",sw) LET t4Lft = w1Rgt-sw LET t4Rgt = w1Rgt LET t4Bas = t4BasLn2 + 5 LET t4Top = t4BasLn1 - 15 LET t4clr1 = litgry LET t4clr2 = yellow LET t4Label1$= "t = " LET t4Label2$= "x = " CALL StringWidth(t4Label2$,sw) LET t4Eqx = t4Lft + sw SUB t4Init CALL t4Clear CALL PlotTextRJ(t4Eqx,t4BasLn1,t4Label1$,t4clr1) CALL PlotTextRJ(t4Eqx,t4BasLn2,t4Label2$,t4clr2) CALL t4Values END SUB SUB t4Clear BOX CLEAR t4Lft-2,t4Rgt+2,t4Bas,t4Top END SUB SUB t4ClearValues BOX CLEAR t4Eqx-2,t4Rgt+2,t4Bas,t4Top END SUB SUB t4Values CALL t4ClearValues LET n1$= using$("--%.#####",t) LET n2$= using$("-%.#####",x) CALL PlotTextRJ(t4Rgt,t4BasLn1,n1$,t4clr1) CALL PlotTextRJ(t4Rgt,t4BasLn2,n2$,t4clr2) END SUB ! --- radio buttons --- DECLARE PUBLIC r1cnt,r1stp,r1siz DECLARE PUBLIC r1lft,r1rgt,r1bas,r1top,r1Name$,r1NameClr DECLARE PUBLIC r1NameList$(),r1ColorList() MAT redim r1NameList$(1:3) MAT READ r1NameList$ DATA "0.02","2","4" MAT redim r1ColorList(1:3) MAT READ r1ColorList DATA 21,21,21 LET r1cnt = 3 LET r1Lft = w1Lft LET r1Top = w1Bas+47 LET r1Name$ = "maximum x" LET r1NameClr= 21 DECLARE DEF r1Within CALL r1SetVars ! --- default parameters --- LET b,oldb = 1.0 LET k,oldk = 1.0 LET vel,olddx0= 0 LET pos,oldfx0= 0.5 LET zoomstate = 1 LET critMarks = 0 CALL SetVars ! --- Draw the screen --- CALL InitScreen SUB InitScreen BOX CLEAR worklft,workrgt,workbas,worktop CALL w1Init CALL w2Init CALL v1Init CALL h1Init CALL h2Init CALL h3Init IF critMarks=1 then CALL MarkCritDamp(k) CALL t1Init IF critMarks=1 then CALL t2Init IF critMarks=1 then CALL t5Init CALL t3Init CALL zoomInit CALL w2Point(vel,pos) CALL w1PlaneGraphs END SUB ! ----------------- Event manager ----------------- DO IF ms<>2 then LET clearFlag= 0 BOX KEEP w1Lft,w1Rgt,w1Bas,w1Top in temp$ DO GET MOUSE: mx,my,ms IF w1Within(mx,my)=true then CALL w1RollOver ELSE IF clearFlag=1 then CALL w1RollOverClear END IF LOOP until ms=2 END IF IF clearFlag=1 then CALL w1RollOverClear END IF IF w2Within(mx,my)=true then CALL w2MouseClickOrDrag ! sliders ELSE IF v1Within(mx,my)=true then ! b IF mxzmLft and mxzmTop and myoldmx or my<>oldmy then BOX SHOW temp$ at w1Lft,w1Bas CALL PlotLine(mx,w1Top+1, mx,w1Bas-1, litmid) CALL PlotLine(w1Lft+1,my, w1Rgt-1,my, litmid) LET t= w1Fncx(mx) LET x= fx(t) CALL t4Init CALL CopyCoords(mx,my,oldmx,oldmy) LET clearFlag= 1 END IF END SUB SUB w1RollOverClear CALL t4Clear BOX SHOW temp$ at w1Lft,w1Bas LET clearFlag= 0 END SUB SUB w2MouseClickOrDrag LET oldmx,oldmy= -999 DO GET MOUSE: mx,my,ms CALL w2wClamp(mx,my) IF mx<>oldmx or my<>oldmy then CALL w2PixelsToMath(mx,my,vel,pos) CALL v1Mark(pos) CALL h1Mark(vel) CALL w2Point(vel,pos) CALL w1PlaneGraphs CALL CopyCoords(mx,my,oldmx,oldmy) LET olddx0= vel LET oldfx0= pos END IF LOOP until ms=3 END SUB SUB w2Point(vel,pos) CALL w2ShowGridLayer CALL t3Set CALL w2MathToPixels(vel,pos,wx,wy) CALL PlotDiamondClr(wx,wy,yellow) END SUB ! ----- v1 slider event ----- SUB v1MouseClick CALL v1GetClickVal(ms,v1Click,pos) CALL v1Action END SUB SUB v1MouseDrag DO CALL v1GetDragVal(ms,v1Places,pos) CALL v1Action LOOP until ms=3 END SUB SUB v1Action IF pos<>oldfx0 then CALL v1Mark(pos) CALL w2Point(vel,pos) CALL w1PlaneGraphs LET oldfx0= pos END IF END SUB ! ----- h1 slider event ----- SUB h1MouseClick CALL h1GetClickVal(ms,h1Click,vel) CALL h1Action END SUB SUB h1MouseDrag DO CALL h1GetDragVal(ms,h1Places,vel) CALL h1Action LOOP until ms=3 END SUB SUB h1Action IF vel<>olddx0 then CALL h1Mark(vel) CALL w2Point(vel,pos) CALL w1PlaneGraphs LET olddx0= vel END IF END SUB ! ----- h2 slider event ----- SUB h2MouseClick CALL h2GetClickVal(ms,h2Click,b) CALL H2Action END SUB SUB h2MouseDrag DO CALL h2GetDragVal(ms,h2Places,b) CALL h2Action LOOP until ms=3 END SUB SUB h2Action IF b<>oldb then CALL w1PlaneGraphs IF critMarks=1 then CALL t5Value LET oldb= b END IF END SUB SUB MarkCritDamp(k) CALL SetCritDamp(k,critDamp) LET wcd = h2Wndx(critDamp) LET cdTop= h2wBas+2 CALL ValueMarker(h2wLft,h2wRgt,wcd,cdtop,litgry) END SUB SUB ValueMarker(wLft,wRgt,wx,wTop,clr) SET COLOR litgry LET wBas= wTop+6 BOX CLEAR wLft-5,wRgt+15,wBas+15,wTop PLOT wx,wTop; wx,wBas PLOT wx,wTop; wx+2,wTop+2; wx-2,wTop+2; wx,wTop CALL Setbc(wx-4,wBas+11,litgry) !CALL SuperSubScriptLJ(wx-4,wBas+11,"b_[c]",litgry) CALL t2Value END SUB SUB Setbc(bclft,bcbas,bcclr) CALL SetTextFont(1,12,"bold") CALL PlotTextLJ(bclft,bcbas,"b",bcclr) CALL StringWidth("b",sw) CALL PlotTextLJ(bclft+sw,bcbas+4,"c",bcclr) END SUB ! ----- h3 slider event ----- SUB h3MouseClick CALL h3GetClickVal(ms,h3Click,k) CALL h3Action END SUB SUB h3MouseDrag DO CALL h3GetDragVal(ms,h3Places,k) CALL h3Action LOOP until ms=3 END SUB SUB h3Action IF k<>oldk then IF critMarks=1 then CALL MarkCritDamp(k) ! CALL MarkNatFreq(k) CALL t5Value END IF CALL w1PlaneGraphs LET oldk= k END IF END SUB ! --- Graphing routines --- SUB w1PlaneGraphs CALL SetVars CALL w1ShowGridLayer SET COLOR yellow LET oldwy= w1Wndy(fx(0)) LET oldwx= w1Lft FOR wx= w1Lft to w1Rgt LET t = w1Fncx(wx) LET x = fx(t) LET wy= w1Wndy(x) IF wy>w1Top and wyw1Top and oldwyw1Top and wyw1Top and oldwyw1Bas and oldwyw1Top) then ! above and below IF wy>oldwy then PLOT oldwx,w1top+1; wx,w1bas-1 ELSE PLOT wx,w1top+1; oldwx,w1bas-1 END IF END IF CALL CopyCoords(wx,wy,oldwx,oldwy) NEXT wx PLOT END SUB END SUB ! --- end of damped vibrations code -------------------