Skip to main content
added 475 characters in body
Source Link
Nasser
  • 156.1k
  • 12
  • 173
  • 396

Change u to u[t] in the call to NDSolve

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {{u1[t]}, {u2[t]}}; sol = NDSolve[{m.u''[t] + c.u'[t] + k.u[t] == {{Sin[2 t]}, {Sin[2 t]}}, initu, initv}, u[t], {t, 0, 100}] 

Mathematica graphicsMathematica graphics

Now M sees that u[t] is {{u1[t]}, {u2[t]}} otherwise it did not know that.

Or you can simplify things little:

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {u1[t], u2[t]}; sol = First@NDSolve[{Thread[m.u''[t] + c.u'[t] + k.u[t] == {Sin[2 t], Sin[2 t]}], initu, initv}, u[t], {t, 0, 100}]; Plot[{u1[t] /. sol, u2[t] /. sol}, {t, 0, 100}, PlotTheme -> "Detailed"] 

Mathematica graphics

Change u to u[t] in the call to NDSolve

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {{u1[t]}, {u2[t]}}; sol = NDSolve[{m.u''[t] + c.u'[t] + k.u[t] == {{Sin[2 t]}, {Sin[2 t]}}, initu, initv}, u[t], {t, 0, 100}] 

Mathematica graphics

Now M sees that u[t] is {{u1[t]}, {u2[t]}} otherwise it did not know that.

Change u to u[t] in the call to NDSolve

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {{u1[t]}, {u2[t]}}; sol = NDSolve[{m.u''[t] + c.u'[t] + k.u[t] == {{Sin[2 t]}, {Sin[2 t]}}, initu, initv}, u[t], {t, 0, 100}] 

Mathematica graphics

Now M sees that u[t] is {{u1[t]}, {u2[t]}} otherwise it did not know that.

Or you can simplify things little:

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {u1[t], u2[t]}; sol = First@NDSolve[{Thread[m.u''[t] + c.u'[t] + k.u[t] == {Sin[2 t], Sin[2 t]}], initu, initv}, u[t], {t, 0, 100}]; Plot[{u1[t] /. sol, u2[t] /. sol}, {t, 0, 100}, PlotTheme -> "Detailed"] 

Mathematica graphics

Source Link
Nasser
  • 156.1k
  • 12
  • 173
  • 396

Change u to u[t] in the call to NDSolve

m = {{2, 0}, {0, 1}}; c = {{3, -.5}, {-.5, .5}}; k = {{4, -1}, {-1, 1}}; initu = u[0] == {{0}, {.1}}; initv = u'[0] == {{1}, {0}}; u[t_] := {{u1[t]}, {u2[t]}}; sol = NDSolve[{m.u''[t] + c.u'[t] + k.u[t] == {{Sin[2 t]}, {Sin[2 t]}}, initu, initv}, u[t], {t, 0, 100}] 

Mathematica graphics

Now M sees that u[t] is {{u1[t]}, {u2[t]}} otherwise it did not know that.