Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica plot

  1. Sep 19, 2010 #1
    I would like to generate a plot displaying the parameter t on the x axis, varying from 0 to 0.95 and the corresponding values of e1. My code below does what I want (I think) but is plotting all the different points on different graphs (all 950 of them!). How can I get it to plot on the same graph? Thanks

    For[i = 0, i ≤ 950, ++i,
    ListPlot[e1 /. NSolve[{equ1 == 0, equ2 == 0, equ3 == 0}
    /. t -> i/1000.0, {e1, e2, e3}]]]
  2. jcsd
  3. Sep 20, 2010 #2
    Make your table of values first, then use ListPlot.
    With out details of your code (or, better yet, a simplified example that shows the same issues) it is not worth trying to give you working code.

    As an aside: don't use For[] unless you really need to test for some condition to end the loop. It's probably best to use Do[] or Table[] for the above type of problem.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Mathematica plot Date
Mathematica Cannot Plot This Function in Mathematica Feb 26, 2018
Is the integral for current correct? Jul 7, 2017
Mathematica Plot Real Portion (Contour Plot) Jun 21, 2017
Mathematica Add a rectangle to a plot to indicate range Jun 15, 2017
Mathematica Part of complex plot disappears [mathematica] Apr 19, 2017