How to create a Graph in Unity

Hi I’m trying to make a graphing calculator in Unity. I have it so that the code would instantiate an object throughout the course of the graph. I realize I could use a particle system to achieve the same effect but for this project I have to do this in this way or some similar form.

using UnityEngine;
using System.Collections;

public class Graph : MonoBehaviour
{
	public Rigidbody GraphPointPrefab;
	public int Resolution = 100;
	private int i = -20;
	private float Xposition = -20;
	private float Yposition = 1;

	void Update () 
	{
		while (i <= Resolution) 
		{
			Yposition = 2 * Xposition +3;//equation

			Instantiate (GraphPointPrefab, new Vector3 (Xposition, Yposition), Quaternion.Euler(0, 0, 0));

			Xposition = + 1;



			i ++;
		}
	}
}

Line 20: Rewrite to:

  Xposition += 1;