Skip to main content
deleted 3 characters in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

So I am trying to make a resonance curve like this one below, using NDSolve.

enter image description here

I tried to use code as below. Basically I try to hold solution for a w (driving frequency value) using NumericQ and then find the max amplitude using FindMaxValue when t is big enough. But my code returns a lot of error code I don't understand. By the way, I am using NDSolve directly, so I can test the accurateness of NDSolve Method.

ClearAll;

f[w_?NumericQ] := 
Block[{sol}, 
  sol = NDSolve[{x''[t] + x'[t] + x[t] == Cos[w*t], x[0] == 0, x'[0] == 0}, 
    x[t], {t, 0, 100}];
 (FindMaxValue[x[t], {t, 50}])[[1]]]

ListLinePlot[Table[f[w], {w, 0, 100, 1}], DataRange -> {0, 100}]

So I am trying to make a resonance curve like this one below, using NDSolve.

enter image description here

I tried to use code as below. Basically I try to hold solution for a w (driving frequency value) using NumericQ and then find the max amplitude using FindMaxValue when t is big enough. But my code returns a lot of error code I don't understand. By the way, I am using NDSolve directly, so I can test the accurateness of NDSolve Method.

ClearAll;

f[w_?NumericQ] := 
Block[{sol}, 
  sol = NDSolve[{x''[t] + x'[t] + x[t] == Cos[w*t], x[0] == 0, x'[0] == 0}, 
    x[t], {t, 0, 100}];
 (FindMaxValue[x[t], {t, 50}])[[1]]]

ListLinePlot[Table[f[w], {w, 0, 100, 1}], DataRange -> {0, 100}]

I am trying to make a resonance curve like this one below, using NDSolve.

enter image description here

I tried to use code as below. Basically I try to hold solution for a w (driving frequency value) using NumericQ and then find the max amplitude using FindMaxValue when t is big enough. But my code returns a lot of error code I don't understand. By the way, I am using NDSolve directly, so I can test the accurateness of NDSolve Method.

ClearAll;

f[w_?NumericQ] := 
Block[{sol}, 
  sol = NDSolve[{x''[t] + x'[t] + x[t] == Cos[w*t], x[0] == 0, x'[0] == 0}, 
    x[t], {t, 0, 100}];
 (FindMaxValue[x[t], {t, 50}])[[1]]]

ListLinePlot[Table[f[w], {w, 0, 100, 1}], DataRange -> {0, 100}]
Source Link

Resonance Curve using NDSolve

So I am trying to make a resonance curve like this one below, using NDSolve.

enter image description here

I tried to use code as below. Basically I try to hold solution for a w (driving frequency value) using NumericQ and then find the max amplitude using FindMaxValue when t is big enough. But my code returns a lot of error code I don't understand. By the way, I am using NDSolve directly, so I can test the accurateness of NDSolve Method.

ClearAll;

f[w_?NumericQ] := 
Block[{sol}, 
  sol = NDSolve[{x''[t] + x'[t] + x[t] == Cos[w*t], x[0] == 0, x'[0] == 0}, 
    x[t], {t, 0, 100}];
 (FindMaxValue[x[t], {t, 50}])[[1]]]

ListLinePlot[Table[f[w], {w, 0, 100, 1}], DataRange -> {0, 100}]