Re: Is it Possible to Create a Logarithmic Slider Control?
- To: mathgroup at smc.vnet.net
- Subject: [mg117366] Re: Is it Possible to Create a Logarithmic Slider Control?
- From: Fred Klingener <gigabitbucket at BrockEng.com>
- Date: Wed, 16 Mar 2011 06:27:59 -0500 (EST)
- References: <ilnh99$oah$1@smc.vnet.net>
On Mar 15, 7:07 am, Morgan Sutherland <skiptra... at gmail.com> wrote: The way I'd do it is with an inner DynamicModule: VMax = 5; Manipulate[ DynamicModule[ {z1 = 10^logz1 , z2 = 10^logz2} , Column[{ "z1 = " <> ToString[z1] , "z2 = " <> ToString[z2] , Grid[{ {Plot[ (VinR*Cos[t] + VinC) , {t, -3, 9} , PlotRange -> {-1, VMax} , AxesLabel -> {"t", "Vin"} ] } , {Plot[ z2/(z1 + z2)*(VinR*Cos[t] + VinC) , {t, -3, 9} , PlotRange -> {-1, VMax} , AxesLabel -> {"t", "Vout"} ] (* Plot *) } } , ItemSize -> 30 ] (* Grid *) }] (* Column *) ] (* Dynamic Module *) , {{logz1, 4}, 1, 6, 1, Appearance -> "Labeled"} , {{logz2, 4}, 1, 6, 1, Appearance -> "Labeled"} , Delimiter , {{VinR, 2.5}, 0, 5} , {VinR} , {{VinC, 2}, -VMax, VMax} , {VinC} , ControlPlacement -> Left ] Hth, Fred Klingener > Greetings List, > > *Question also posted here: *http://stackoverflow.com/questions/5307244/l= ogarithmic-slider-control... > > I'm making a small interface for calculating voltage dividers in > Mathematica. I have two sliders (z1 & z2) that represent the resistor val= ues > and a couple of sliders to represent Vin as a sinusoid. > > The issue is that the range of available resistor values (in the real wor= ld) > is roughly logarithmic on {r, 100, 1,000,000}. If I set my slider range t= o r, > however, it's impractical to select common low resistor values in approx.= {100, > 10,000}. > > Is it possible to create a slider that sweeps through a logarithmic range= ? > > Thanks! > > Manipulate[ > Grid[{{Plot[(VinR*Cos[t] + VinC), {t, -3, 9}, > PlotRange -> {-1, VMax}, AxesLabel -> {t, Vin}]}, {Plot[ > z2/(z1 + z2)*(VinR*Cos[t] + VinC), {t, -3, 9}, > PlotRange -> {-1, VMax}, AxesLabel -> {t, Vout}]}}, > ItemSize -> 20], > {{z1, 10000}, 10, 1000000, 10}, {z1}, {{z2, 10000}, 10, > 1000000}, {z2}, Delimiter, {{VinR, 2.5}, 0, > 5}, {VinR}, {{VinC, 2}, -VMax, VMax}, {VinC}]