Hi dear. I am a newbie in Julia. I wanted to solve two first differential equations as
di/dt=-(R/L)i-(1/L)*v+(1/L)a
dv/dt=(1/C)i
with Julia which R,L, C is constant and the variable is i(t) and v(t).
I used the function Lorenz!(du,u,p,t) but plot is a sinusoidal waves, while it should be a damed sinusoidal wave
This is my Code:
using Plots
using DifferentialEquations
R=0.1;
L=0.01
C=0.001;
a=1;
function lorenz!(du,u,p)
du[1]=-(R/L)*u[1]-(1/L)*u[2]+(1/L)*a;
du[2]=(1/C)*u[1];
end
u0=[0,0];
tspan = (0.0,100)
prob = ODEProblem(lorenz!,u0,tspan)
sol = solve(prob)
gr()
plot(sol,vars=(0,1))