TransWikia.com

NDSolve Error - There are fewer dependent variables, than equations, so the system is overdetermined

Mathematica Asked by Kacper on July 29, 2021

I have a program in which I am simulating the motion of two-wheel vehicle. I have four global parameters xo (position x of rear wheel), yo (position y of rear wheel), teta (the angle of inclination of the vehicle from the horizontal) and fi (the steering angle of the front wheel). In my opinion it’s not necessary to understand the derivation of equations, but it’s important that I have 4 differential equations with parameters Lambda1 and Lambda2. These parameters I can find from another two equations with Solve Method. At the end I’m changing xo, yo, teta and fi to parameters depending from time.

{lo = 3.0, Jo = 1.0, ω = π/30, m = 1.0};
xo'' = -Sin[θ]/m*λ1 + 
   Sin[θ + ϕ]/m*λ2;

yo'' = Cos[θ]/m*λ1 + 
   Cos[θ + ϕ]/m*λ2;

θ'' = λ2*lo/Jo*Cos[ϕ];

ϕ'' = 0;

f1[xo_, yo_, θ_, ϕ_] := -xo''*Sin[θ] - 
   xo'*Cos[θ]*θ' + yo''*Cos[θ] - 
   yo'*Sin[θ]*θ';
f2[xo_, yo_, θ_, ϕ_] := 
  yo''*Cos[θ + ϕ] - 
   yo'*Sin[θ + ϕ]*(θ' + ϕ') - 
   xo''*Sin[θ + ϕ] - 
   xo'*Cos[θ + ϕ]*(θ' + ϕ') + 
   lo*θ''*Cos[ϕ] - lo*θ'*Sin[ϕ]*ϕ';
s = Solve[
   f1[xo, yo, θ, ϕ] == 0 && 
    f2[xo, yo, θ, ϕ] == 0, {λ1, λ2}];
λ1 = s[[All, 1, 2]];
λ2 = s[[All, 2, 2]];
λ1 = λ1 /. {θ -> a[t], θ' -> 
    a'[t], ϕ -> b[t], ϕ' -> b'[t], xo -> x[t], yo -> y[t], 
   xo' -> x'[t], yo' -> y'[t]}
λ2 = λ2 /. {θ -> a[t], θ' -> 
    a'[t], ϕ -> b[t], ϕ' -> b'[t], xo -> x[t], yo -> y[t], 
   xo' -> x'[t], yo' -> y'[t]}

And until this point everything work perfect. Than I need to solve the system of differential equations. My initial conditions are: x[0]=0, x'[0]=1, y'[0]=1, y[0]=0, a[0]=0. b parameter is
controllable so if I write b”[0] = 0, b'[0] = 0, b[0] = 0 it means that I have my steering wheel in the same position whole motion (so on the graph I will see straight line). I’m trying NDSolve method but there is an error: error My code:

s2 = NDSolve[{x''[t] == -Sin[a[t]]/m*λ1 + 
     Sin[a[t] + b[t]]/m*λ2 , x[0] == 0 , x'[0] == 0, 
   y''[t] == Cos[a[t]]/m*λ1 + Cos[a[t] + b[t]]/m*λ2, 
   y[0] == 0 , y'[0] == 1, a''[t] == λ2*lo/Jo*Cos[b[t]], 
   a[0] == 0 , b''[0] == 0, b'[0] == 0, b[0] == 0}, {x[t], y[t], a[t],
    b[t]}, {t, 0, 100}]

Rest of code is visualization – it should work, but I do not guarantee.

plots = Table[
  ParametricPlot[
   Evaluate[{s2[All, 1, 2], s2[All, 2, 2]}], {t, 0, r}], {r, 100}] 
ListAnimate[plots, AnimationRate -> 5]
Export["animate.avi", plots] 

Any ideas what should i do?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP