|
| 1 | +clc |
| 2 | +clear all |
| 3 | +warning off |
| 4 | + |
| 5 | + |
| 6 | +% draw main circle |
| 7 | +r0=20;% actual radius |
| 8 | +r=20; %assumed radius |
| 9 | + |
| 10 | + |
| 11 | +nos=zeros(100,100); |
| 12 | +nop=40; |
| 13 | +t=0:2*pi/nop:2*pi; |
| 14 | +x=r0*cos(t)+50; |
| 15 | +y=r0*sin(t)+50; |
| 16 | +plot(x,y,'red','LineWidth',5); |
| 17 | +%txt='1) Having Same Radius'; |
| 18 | +%text(2,9.5,txt,'FontSize',14) |
| 19 | +pause(0.000002); |
| 20 | +frame_h=get(handle(gcf),'JavaFrame'); |
| 21 | +set(frame_h,'maximized',1); |
| 22 | +axis([0,100,0,100]); |
| 23 | +axis square; |
| 24 | +pause(1); |
| 25 | +hold on; |
| 26 | + |
| 27 | + |
| 28 | +%draw outer circles |
| 29 | + |
| 30 | +for i=1:nop |
| 31 | + x3=x(i)+r*cos(t); |
| 32 | + y3=y(i)+r*sin(t); |
| 33 | + plot(x3,y3,'black'); |
| 34 | + %[a,b]=circcirc(5,5,2,x(i),y(i),2); |
| 35 | + %plot(a,b,'LineStyle','none','Marker','o','MarkerEdgeColor','blue','MarkerFaceColor','blue') |
| 36 | + if i>1 |
| 37 | + for j=i:-1:1 |
| 38 | + [d,e]=circcirc(x(i),y(i),r,x(j),y(j),r); |
| 39 | + |
| 40 | + nanchck=isnan(d); |
| 41 | + |
| 42 | + plot(d,e,'LineStyle','none','Marker','o','MarkerEdgeColor','blue','MarkerFaceColor','blue') |
| 43 | + j=j-1; |
| 44 | + if nanchck~=1 |
| 45 | + f=round(d(1)); |
| 46 | + f1=round(d(2)); |
| 47 | + g=round(e(1)); |
| 48 | + g1=round(e(2)); |
| 49 | + |
| 50 | + nos(f,g)=nos(f,g)+1; |
| 51 | + nos(f1,g1)=nos(f1,g1)+1; |
| 52 | + |
| 53 | + end |
| 54 | + end |
| 55 | + end |
| 56 | + % plot(5,5,'LineStyle','none','Marker','o','MarkerEdgeColor','red','MarkerFaceColor','red') |
| 57 | + axis square |
| 58 | + hold on; |
| 59 | + pause(0.5); |
| 60 | + i=i+1; |
| 61 | + |
| 62 | +end |
| 63 | + |
| 64 | +figure, mesh(nos); |
0 commit comments