How to plot concentric circles in MATLAB: Getting started with MATLAB

How to draw concentric circles in MATLAB? i-St@r comes with the solution! Here is the MATLAB code for concentric circles. It plots 3 circles on a same window. The logic behind this program is quite simple, that is we know that the transfer characteristics between Sine wave and Cosine wave will produce a circle. The same idea us used here also. We has already discussed how to plot a circle using MATLAB earlier. In this post we are going to plot three concentric circles with different radius in MATLAB. Amplitude determine the radius of the circle. Green font color comments are given next to each code for better understanding.
Also Read: 

MATLAB code for concentric circles

clc;%Clear screen
clearall;%Clear all varibles
closeall;%Close all unwanted windows

t=0:0.001:1;%Initializing time samples

%Transfer chara of sine and cosi.e sin Vs Cos will give circle
%Here we are plotting group of sine Vscos with differnt amplitudes

s1=3*sin(2*pi*t);%Sine wave with amplitude=3unit
c1=3*cos(2*pi*t);%Cosine wave with amplitude=3unit

s2=2*sin(2*pi*t);
c2=2*cos(2*pi*t);

s3=1*sin(2*pi*t);
c3=1*cos(2*pi*t);

plot(s1,c1,s2,c2,s3,c3);%Plotting sin Vs Cos
gridon;%Enable grid lines
axisequal;%Equal width of X and Y axis

Concentric circles in MATLAB

Matlab concentric circle

Hope this code works fine for you. Use the comment box below for any more assistance. :)
Ads


0 comments:

Post a Comment

 

Copyright © 2011 CircuitsGallery| ToS | Privacy Policy |

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