0

I need to plot y1 against t1 in C#; these are my array. can you please tell me how can I do that? I'm Very new to C# and I don't know it well. Thanks here is my codes:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Research.Oslo;


namespace odestiff
{
    class Program
    {
        static void Main(string[] args)
        {

            //solve the equations with Gear method
            var sol = Microsoft.Research.Oslo.Ode.GearBDF(
           0,
           new Vector(2, 0),
            (t, x) => new Vector(
            x[1],
            1000 * (1 - x[0]*x[0]) * x[1] - x[0])).TakeWhile(p => p.T <= 3000).ToArray();  //define the time span


            //// put results in an array
            double[] y1 = sol.Select(p => p.X[0]).ToArray();
            double[] t1 = sol.Select(p => p.T).ToArray();

        }
    }
}
Mahan M.
  • 11
  • 3

1 Answers1

0

Use the Charts form in the Toolbox (on the left in visual studio)

Then you can add points like this

chart1.Series["SeriesName"].Points.AddXY(t1, y1);

Here is a link to the msdn:

https://msdn.microsoft.com/en-us/library/dd489237.aspx

Cody Popham
  • 992
  • 5
  • 14