Skip to main content
added 2 characters in body
Source Link
Nasser
  • 150.3k
  • 12
  • 161
  • 374

Do I have to use NDSolve?

Yes

If so, how?

Something like

ClearAll[θ,t,g,x];
L   =  1;
Mp  =  2;
Mc  =  3;
θ0  = 5 Degree;
x1  = 0;
x0  = 4;
θ1  = 0;
g   = 9.81;

ode1 = Cos[θ[t]] x''[t] - L θ''[t] + g Sin[θ[t]] == 0;
ode2 = - Mp L Cos[θ[t]] θ''[t] + Mp L Sin[θ[t]] (θ'[t])^2 + (Mc + Mp) x''[t] == 0;
ic  = {θ[0] == θ0, θ'[0] == θ1, x[0] == x0, x'[0] == x1};

sol = NDSolve[{ode1,ode2,ic},{θ, x}, {t,0,5}]

See help on NDSolve on how to do processing on result, i.e. plot, etc..

Do I have to use NDSolve?

Yes

If so, how?

Something like

ClearAll[θ,t,g,x];
L   =  1;
Mp  =  2;
Mc  =  3;
θ0  = 5 Degree;
x1  = 0;
x0  = 4;
θ1  = 0;
g   = 9.81;

ode1 = Cos[θ[t]] x''[t] - L θ''[t] + g Sin[θ[t]] == 0;
ode2 = Mp L Cos[θ[t]] θ''[t] + Mp L Sin[θ[t]] (θ'[t])^2 + (Mc + Mp) x''[t] == 0;
ic  = {θ[0] == θ0, θ'[0] == θ1, x[0] == x0, x'[0] == x1};

sol = NDSolve[{ode1,ode2,ic},{θ, x}, {t,0,5}]

See help on NDSolve on how to do processing on result, i.e. plot, etc..

Do I have to use NDSolve?

Yes

If so, how?

Something like

ClearAll[θ,t,g,x];
L   =  1;
Mp  =  2;
Mc  =  3;
θ0  = 5 Degree;
x1  = 0;
x0  = 4;
θ1  = 0;
g   = 9.81;

ode1 = Cos[θ[t]] x''[t] - L θ''[t] + g Sin[θ[t]] == 0;
ode2 = - Mp L Cos[θ[t]] θ''[t] + Mp L Sin[θ[t]] (θ'[t])^2 + (Mc + Mp) x''[t] == 0;
ic  = {θ[0] == θ0, θ'[0] == θ1, x[0] == x0, x'[0] == x1};

sol = NDSolve[{ode1,ode2,ic},{θ, x}, {t,0,5}]

See help on NDSolve on how to do processing on result, i.e. plot, etc..

Source Link
Nasser
  • 150.3k
  • 12
  • 161
  • 374

Do I have to use NDSolve?

Yes

If so, how?

Something like

ClearAll[θ,t,g,x];
L   =  1;
Mp  =  2;
Mc  =  3;
θ0  = 5 Degree;
x1  = 0;
x0  = 4;
θ1  = 0;
g   = 9.81;

ode1 = Cos[θ[t]] x''[t] - L θ''[t] + g Sin[θ[t]] == 0;
ode2 = Mp L Cos[θ[t]] θ''[t] + Mp L Sin[θ[t]] (θ'[t])^2 + (Mc + Mp) x''[t] == 0;
ic  = {θ[0] == θ0, θ'[0] == θ1, x[0] == x0, x'[0] == x1};

sol = NDSolve[{ode1,ode2,ic},{θ, x}, {t,0,5}]

See help on NDSolve on how to do processing on result, i.e. plot, etc..