1
$\begingroup$

I have a function like this:

E^(-t/0.001)*Cos[t] + E^(-t/0.01)*Cos[1000 t]

I used the code below as suggested in the forum to obtain the x,y values for points

data = Cases[Plot[Exp@(-1000 x)*Cos@ x + Exp@(-100 x)*Cos@ (1000 x), {x, 0, 0.1}], Line[data_] :> data, -4, 1][[1]]

However, it works (plotting back the list of number obtained I generete the original function) only when inside the exp functions I insert numbers such as (2, 3), (1000, 10) and so on, but not if I use (1000,100) or (10000, 1000) and so on. Can someone help me to understand what is the problem. Thank you

$\endgroup$
1
$\begingroup$
Clear["Global`*"]

The default PlotRange can truncate the curve resulting in multiple lines.

plt = Plot[Exp[-1000 x]*Cos@x + Exp[-100 x]*Cos[1000 x], {x, 0, 0.1}]

enter image description here

Note that with the PlotRange truncated, there are multiple separate lines

ListLinePlot[
 Cases[plt, Line[data_] :> data, Infinity],
 PlotLegends -> Automatic]

enter image description here

When the PlotRange does not truncate the curve, there is a single line

plt2 = Plot[Exp[-1000 x]*Cos@x + Exp[-100 x]*Cos[1000 x], {x, 0, 0.1}, 
  PlotRange -> Full]

enter image description here

The resulting single line can be displayed fully

ListLinePlot[
 Cases[plt2, Line[data_] :> data, Infinity],
 PlotRange -> Full]

enter image description here

or truncated by the PlotRange

ListLinePlot[
 Cases[plt2, Line[data_] :> data, Infinity]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.