How to draw (plot) a circle using MATLAB?

How to draw a circle in MATLAB? This is a commonly asked question from many MATLAB beginners. Here is the MATLAB code to plot a circle. The transfer characteristics between sine wave and cosine wave will give a circle. So here first we define a sine and a cosine wave, then plotting a circle in MATLAB becomes so simple, just plot the sine Vs Cosine. Following are the codes for MATLAB circle plot. The codes are well commented for easy interpretation.

Also Read:  How to plot Concentric circles in MATLAB?   

MATLAB circle codes

clc;
clear all;
close all;
t=0:0.001:1;
s=sin(2*pi*2*t);
c=cos(2*pi*2*t);
plot(s,c);%Plotting sin Vs cos
axis('equal');%Equal length fox X and Y axis

Output of MATLAB circle code

Circle in MATLAB
Ads


0 comments:

Post a Comment

 

Copyright © 2011 CircuitsGallery| ToS | Privacy Policy |

Contact Us | Write For Us | Advertise on Circuits Gallery | About Us