A **mathematical curve** can be defined as a function *y = f(x)*, where *x* is the coordinate of the horizontal axis and *y* is the value of the function in that *x* point. However, not all curves can be defined this way. **Parametric equations** or functions are a way of defining mathematical curve function of a third variable *t* called a **parameter**:

x &= f(t)\\

y &= g(t)

\end{split} \]

where:

*t* – parameter

*f*, *g* – functions of *t*

*x*, *y* – coordinates

Through **parametric equations** we can express the coordinates of the points that makes up a geometric object such as a curve or surface, in which case the equations are collectively called a parametric representation of the object.

Using Scilab, we can easily plot parametric equations/functions using the `plot2d()`

function. For a better understanding we are going to plot the parametric functions of the:

- circle
- elipse
- astroid
- cycloid
- cardioid
- lemniscate of Bernoulli
- nephroid
- deltoid

Before diving into the parametric equations plot, we are going to define a custom Scilab function, named `fPlot()`

. Since the formatting of the plot is going to be the same for all examples, it’s more efficient to use a custom function for the plot instructions. The function is going to be called for each parametric equation plot.

function fPlot(x,y) hf=gcf(); hf.background=8; hf.children.font_size=3; plot2d(x,y,frameflag=4); ha=gca(); ha.children.children.foreground=2; xgrid(); xlabel("x","FontSize",3) ylabel("y","FontSize",3) title("x-engineer.org","FontSize",3) endfunction

### Circle

A **circle** can be defined in an **x-y Cartesian coordinate system**, through the equation:

where:

*a* – the x-coordinate of the center

*b* – the y-coordinate of the center

*r* – the radius of the circle

The **equation of the circle** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a + r \cdot cos(t)\\

y &= b + r \cdot sin(t)

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π*.

Geometrically, the parameter *t* can be interpreted as the angle between the segment from *(a, b)* to *(x, y)* and the positive x-axis.

The definition of the **circle parameters** and equations is done with the Scilab instructions:

a=1; b=2; r=2; t=linspace(0,2*%pi,100); x=r*cos(t)+a; y=r*sin(t)+b; figure(1) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Ellipse

An **ellipse** can be defined in an x-y Cartesian coordinate system, through the equation:

where the parameters *a* and *b* are called the semi-major and semi-minor axes.

The **equation of the ellipse** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a \cdot cos(t)\\

y &= b \cdot sin(t)

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π*.

The definition of the **ellipse parameters** and equations is done with the Scilab instructions:

a=2; b=1; t=linspace(0,2*%pi,100); x=a*cos(t); y=b*sin(t); figure(2) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Astroid

An **astroid** can be defined in an x-y Cartesian coordinate system, through the equation:

The **equation of the astroid** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a \cdot \cos ^{3}(t)=\frac{a}{4} \cdot \left ( 3 \cdot \cos(t)+\cos(3 \cdot t) \right )\\

y &= a \cdot \sin ^{3}(t)=\frac{a}{4} \cdot \left ( 3 \cdot \sin(t)-\sin(3 \cdot t) \right )

\end{split} \]

where *t* is the parametric variable in the range *0* to 2π.

The definition of the **astroid parameters** and equations is done with the Scilab instructions:

a=2; t=linspace(0,2*%pi,100); x=a*cos(t).^3; y=a*sin(t).^3; figure(3) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Cycloid

A **cycloid** can be defined in an x-y Cartesian coordinate system, through the equation:

where *r* is the radius of the rolling circle.

The **equation of the cycloid** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= r \cdot \left ( t-\sin(t) \right )\\

y &= r \cdot \left ( 1-\cos(t) \right )

\end{split} \]

where t is the parametric variable in the range 0 to 2π.

The definition of the **cycloid parameters** and equations is done with the Scilab instructions:

a=2; t=linspace(0,4*%pi,100); x=a*(t-sin(t)); y=a*(1-cos(t)); figure(4) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Cardioid

A **cardioid** can be defined in an x-y Cartesian coordinate system, through the equation:

where *a* is the common radius of the two generating circles with midpoints *(-a, 0)* and *(a, 0)*.

The **equation of the cardioid** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a \cdot (2 \cdot \cos(t) – \cos(2 \cdot t))\\

y &= a \cdot (2 \cdot \sin(t) – \sin(2 \cdot t))

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π*.

The definition of the **cardioid parameters** and equations is done with the Scilab instructions:

a=2; t=linspace(0,2*%pi,100); x=a*(2*cos(t)-cos(2*t)); y=a*(2*sin(t)-sin(2*t)); figure(5) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Lemniscate of Bernoulli

The **lemniscate of Bernoulli** can be defined in an x-y Cartesian coordinate system, through the equation:

The **equation of the lemniscate of Bernoulli** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a \cdot \sqrt{\cos(2 \cdot t)} \cdot \cos(t)\\

y &= a \cdot \sqrt{\cos(2 \cdot t)} \cdot \sin(t)

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π*.

The definition of the **lemniscate of Bernoulli parameters** and equations is done with the Scilab instructions:

a=2; t=linspace(0,2*%pi,100); x=a*sqrt(cos(2*t)).*cos(t); y=a*sqrt(cos(2*t)).*sin(t); figure(6) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Nephroid

The **nephroid** can be defined in an x-y Cartesian coordinate system, through the equation:

where *a* is the radius of the small circle and half the radius of the big circle.

The **equation of the nephroid** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= a \cdot (3 \cdot \cos(t) – \cos(3 \cdot t))\\

y &= a \cdot (3 \cdot \sin(t) – \sin(3 \cdot t))

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π*.

The definition of the **nephroid parameters** and equations is done with the Scilab instructions:

a=2; t=linspace(0,2*%pi,100); x=a*(3*cos(t)-cos(3*t)); y=a*(3*sin(t)-sin(3*t)); figure(7) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

### Deltoid

The **deltoid** can be defined in an x-y Cartesian coordinate system, through the equation:

where *a* is the radius of the rolling circle.

The **equation of the deltoid** can be written in **parametric form**, using the trigonometric functions sine and cosine:

x &= (b-a) \cdot \cos(t)+a \cdot \cos \left(\frac {b-a}{a} \cdot t\right)\\

y &= (b-a) \cdot \sin(t)-a \cdot \sin \left(\frac {b-a}{a} \cdot t\right)

\end{split} \]

where *t* is the parametric variable in the range *0* to *2π* and *b* is the radius of the circle within which the aforementioned circle is rolling. (In the animation above *b = 3·a*)

The definition of the **deltoid parameters** and equations is done with the Scilab instructions:

a=2; b=6; t=linspace(0,2*%pi,100); x=(b-a)*cos(t)+a*cos(((b-a)/a)*t); y=(b-a)*sin(t)-a*sin(((b-a)/a)*t); figure(8) fPlot(x,y)

Running the Scilab instructions above will output the following graphical window:

We can also use FOR loops to plot the deltoid for different ratios between radius a and radius b. With the Scilab script below we are going to plot, on the same axes, the deltoid for the *b/a* ratio from *3* to *10*.

a=2; b=[3 4 5 6 7 8 9 10]*a; t=linspace(0,2*%pi,100); figure(9) for i=1:length(b) x(i,:)=(b(i)-a)*cos(t)+a*cos(((b(i)-a)/a)*t); y(i,:)=(b(i)-a)*sin(t)-a*sin(((b(i)-a)/a)*t); fPlot(x(i,:),y(i,:)) end

Running the Scilab instructions above will output the following graphical window:

For any questions, observations and queries regarding the article, use the comment form below.

Don’t forget to Like, Share and Subscribe!