How to draw concentric circles in MATLAB? Here we come 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.
Matlab Code for Concentric Circles
[cc lang=”Matlab”]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
plot(s1,c1,s2,c2,s3,c3);%Plotting sin Vs Cos
gridon;%Enable grid lines
axisequal;%Equal width of X and Y axis[/cc]
Hope this code works fine for you to build a concentric circle within seconds.
Leave a Reply