type conversion - Method error when using DifferentialEquations.jl Julia package -


i'm trying solve ode45 differential equation differentialequation.jl package i'm getting method error.

using differentialequations  m = 400; m = 35; c = 3e3; c = 300; k = 50e3; k = 200e3; = 0.05; l = 0.5; vh = 13.9  mm = [m 0;       0 m] # mass matrix  cc = [c -c;      -c c+c] # damping matrix  kk = [k -k;      -k k+k] # stiffness matrix  w(t) = a*sin(2*pi*vh*t/l) wd(t) = a*2*pi*vh*t/l*cos(2*pi*vh*t/l) # dw/dt  n = 2 # number of (original) equations mi = mm^(-1) aa = [zeros(n,n) eye(n); -mi*kk -mi*cc]  f(t) = [0; c*wd(t)+k*w(t)] # force vector g(t,y) = aa*y+[zeros(n,1); mi*f(t)]  y0 = zeros(4) # initial conditions tspan = (0.0, 0.5) # time span  prob = odeproblem(g, y0, tspan) # defining problem solve(prob)  

the code gives error says:

methoderror: cannot convert object of type array{float64,2} object of type array{float64,1} may have arisen call constructor array{float64,1}(...), since type constructors fall convert methods.

i not might doing wrong, although believe error might have y0 (since typeof(y0) = array{float64,1}) , error occures in line solve() function is.

thanks beforehand!

untested hunch: change:

g(t,y) = aa*y+[zeros(n,1); mi*f(t)] 

to:

g(t,y) = aa*y+[zeros(n); mi*f(t)] 

the former create two-dimensional matrix 1 column. latter create one-dimensional vector. error message you're seeing it's getting 2 dimensional array in place expects one-dimensional one.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -