From: Fernando C. <el....@gm...> - 2009-06-07 04:09:23
|
There was a bad indented line (t0 = tinicial)... Sorry! This is the code. I could add the plotting, but i couldn't draw the surface. def funhomo(x,t): return eigenvector[0,0]*cos(wfrec*t)*sin(pi*x/(2*L))+eigenvector[1,0]*cos(wfrec*t)*sin(3*pi*x/(2*L))+eigenvector[2,0]*cos(wfrec*t)*sin(5*pi*x/(2*L)) it=int(raw_input("ingrese numero de puntos a obtener: ")) xinicial=0 tinicial=0 hx=float(raw_input("ingrese paso de x: ")) ht=float(raw_input("ingrese paso de t: ")) funclst=[] x0 = xinicial t0 = tinicial for i in range(0,it+1): x=x0 for j in range(0,it+1): t=t0 f=funhomo(x,t) t0=t+ht print x,t,f funclst.append([x,t,f]) t0 = tinicial x0=x+hx #print funclst gp = Gnuplot.Gnuplot(debug=1) gp.clear() plot1 = Gnuplot.PlotItems.Data(funclst, with_="points", title="Superficie") gp.splot(plot1) -- Fernando Cladera <el....@gm...> |