Solved : The problem was time should be 1/100 and not 1/10 t = float([0:0.01:50]); I knew there was something wrong because I got it right before but I certainly modify it without even noticing it Thanks for your help Henri
Le mercredi 29 juin 2016 13:31:42 UTC+2, Henri Girard a écrit : > > Hi, > I can't get a sinusoidal like with pyplot, I got it once but I lost my > config. > Any help ? > > > > using Sundials,ODE,Plots > pyplot(size=(300,200),leg=false, > guidefont=font(7), titlefont=font(7)); > function oscillator(t, y, ydot) > ydot[1] = y[2] > ydot[2] = - 3 * y[1] - y[2] / 10 > end > initial = [1.0,0.0]; # Initial conditions > t = float([0:1.125:30]); # Time steps for solution > xv = Sundials.cvode(oscillator, initial, t); > xv[1:5,:] > plot(t,xv[:,1],title="Mouvement", > bg=RGB(.2,.2,.2), > xlabel ="Temps",ylabel = "Vitesse") > vₓ=xv[:,1] > vᵥ=xv[:,2] > plot(vₓ,vᵥ,title="Mouvement", > bg=RGB(.2,.2,.2), > xlabel ="Temps",ylabel = "Vitesse") >
