TransWikia.com

Plotting using a ListPlot

Mathematica Asked by user4933 on May 19, 2021

I am trying to implement a simple Do loop, but the plot is not printing.

Could you point out what is wrong here and how to stop the error from occurring?

With[{[Gamma] = 1, k = 1, [Sigma]1 = 1, [Sigma]2 = 1, dt = 0.01, 
  tfinal = 20, v1 = 2, v2 = 5},
 dtsqrt = Sqrt[dt];
 x1 = 0;
 x2 = 0;
 veclist = {{x1, x2}};
 Do[
  w1 = dtsqrt RandomVariate[NormalDistribution[0, 1]];
  w2 = dtsqrt RandomVariate[NormalDistribution[0, 1]];
  x1 += k x1 - x2 (k + [Gamma]) + dtsqrt w1;
  x2 += k x1 - x2 (k + [Gamma]) + dtsqrt w2;
  AppendTo[veclist, {x1, x2}];
  ,
  {t, dt, tfinal, dt}];
  ListPlot[veclist, Joined -> True]
  ]

One Answer

The data range is too great

Clear["Global`*"]

With[{γ = 1, k = 1, σ1 = 1, σ2 = 1, dt = 0.01, 
  tfinal = 20, v1 = 2, v2 = 5},
 dtsqrt = Sqrt[dt];
 x1 = 0;
 x2 = 0;
 veclist = {{x1, x2}};
 Do[w1 = dtsqrt RandomVariate[NormalDistribution[]];
  w2 = dtsqrt RandomVariate[NormalDistribution[]];
  x1 += k x1 - x2 (k + γ) + dtsqrt w1;
  x2 += k x1 - x2 (k + γ) + dtsqrt w2;
  AppendTo[veclist, {x1, x2}], {t, dt, tfinal, dt}];
 Print[MinMax /@ Transpose[veclist]];
 ListLogLogPlot[Abs[veclist], Joined -> True]]

(* {{-5.30964097304293*10^599,2.654820486521465*10^599},{-1.061928194608586*10^600,5.30964097304293*10^599}} *)

enter image description here

Answered by Bob Hanlon on May 19, 2021

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