Previously we discussed about, How to generate multiple waveform and plot them on single window in MATLAB. Now in Module-1 Post-6,  we will discuss, How to create a circle function in MATLAB.

For this example, we have taken three parameter i.e. area, perimeter and diameter of a circle. Screen capture of matlab program for circle function is shown in figure.1. This matlab program consists of executable codes in black colors along with their brief description in green color.

Figure.1 - MATLAB Program for Circle Function.

This matlab program consists of 7 lines of codes and its detailed description is as follows:

Line-06 : Display matter whatever written in single quote i.e. '   '.
Line-07 : Calculate the area of circle for the value of r.
Line-08 : Calculate the perimeter of circle for the value of r.
Line-09 : Calculate the diameter of circle for the value of r.
Line-10 : Display the matter along with the value of variable written after coma at a place where %g is placed.
Line-11 : Display the matter along with the value of variable written after coma at a place where %g is placed.
Line-12 : Display the matter along with the value of variable written after coma at a place where %g is placed.

To use circle function, type the name of function in command window. The result will also be display in command window. The screen capture of command window is shown in figure 2.

Figure.2 - Output generated using Circle Function.

The user can increase or decrease the feature of circle function according to his need.

Video Tutorial : How To Create a Function in MATLAB By INFO4EEE

1. 2. 3. 