Re: Plot to Plot3D problem
- To: mathgroup at smc.vnet.net
- Subject: [mg83383] Re: Plot to Plot3D problem
- From: Peter Pein <petsie at dordos.net>
- Date: Mon, 19 Nov 2007 06:10:52 -0500 (EST)
- References: <fhp603$3bm$1@smc.vnet.net>
Hi Jerry, I guess there is a reason why you do not DSolve your equation and work with that result... I'm using Version 5.2. The Rf in the pattern sol[Rf_] is another one than the Rf used in the rest of your example. To avoid trouble, use: sol[rf_] := First@NDSolve[eqs /. Rf -> rf, vo, {t, -10, 5}] If you use Evaluate in the Plot3D function, evaluation will take place before a value for sol[..] is known. I used successfully Plot3D[(vo /. sol[10^lrf])[t], {t, -2, 5/2}, {lrf, 4, 7}, PlotRange -> All, AxesLabel -> {"t", "log10(Rf)", "vo"}, PlotPoints -> {33, 49}, Mesh -> False] (I changed the scale of Rf to logarithmic, because the linear scale seemed boring to me) HTH, Peter Jerry schrieb: > Greetings all. Could someone please give me a tip on what > I'm doing wrong when trying to convert a working Plot > routine to a Plot3D routine? > > I'm using V6.01 on XP. > > The first code set below works fine, using a fixed value for > the parameter Rf. > > In the second code set, I don't set parameter Rf and I try > to use it as one variable in Plot3D. I've tried every > combination of set or set delayed for eqs and sol and tried > inserting Evaluate all over the place and haven't hit > goodness yet. Clearly I'm not ready for prime time on my own. > > Would appreciate any suggestions. > > > > (* this works *) > a = 1.0; w = 1.57; > Rf = 1*10^6; > R = 1000; c = 2*10^-6; > > v2[t_] := Exp[-a t^2] Sin[w t]; > v3[t_] := v2'[t]; > > eqs = {vo'[t] == -(v3[t]/R/c + vo[t]/Rf/c), vo[-5] == 0}; > > sol = NDSolve[{eqs}, vo, {t, -10, 5}] > > Plot[ Evaluate[ vo[t] /. sol], {t, -5, 5} ] > > ********************** > > (* this doesn't work *) > a = 1.0; w = 1.57; > (* parameter Rf specified in Plot3D below *) > R = 1000; c = 2*10^-6; > > v2[t_] := Exp[-a t^2] Sin[w t]; > v3[t_] := v2'[t]; > > eqs = {vo'[t] == -(v3[t]/R/c + vo[t]/Rf/c), vo[-5] == 0}; > > sol[Rf_] := NDSolve[{eqs}, vo, {t, -10, 5}] > > Plot3D[ Evaluate[ vo[t] /. sol[Rf] ], {t, -5, 5}, > {Rf, 1*^6,5*^6} ] >