cantor set help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

cantor set help

kenChan_123kenChan_123 Posts: 2Member
Based on the recursion technique, compute the cantor set.The Cantor set is obtained by removing from the segment [0,1] the middle thirds.For the given N (the number of steps), your code should display a narrow black rectangle with removed pieces (in white). As the final outcome, plot 6 first steps (in the same figure) of construction
of the Cantor set. Your graph should be a column consisting of 6 stripes.


function Z=cantor_set(n)
x1=0; y1=0;
x2=1; y2=0;
x3=1; y3=1;
x4=0; y4=1;
figure(1)
hold on
set(gca,'xtick',[],'ytick',[]);
set(gca,'XColor','w','YColor','w');
fill([x1 x2 x3 x4], [y1 y2 y3 y4],'k');
rectangle1(x1,y1,x2,y2,x3,y3,x4,y4,0,Lmax);
hold off
function Z=rectangle1(x1,y1,x2,y2,x3,y3,x4,y4,n,Lmax)
if n<Lmax

For this question, I just manage to do the beginning .but I don't know how to apply the cantor set rule in matlab. I really don't know how to put it in atlab. May anyone help me please?
Sign In or Register to comment.