x = [1 2 3 4 5 6 7 8 9 10]; y1 = [.16 .08 .04 .02 .013 .007 .004 .002 .001 .0008 ]; y2 = [.16 .07 .03 .01 .008 .003 .0008 .0003 .00007 .00002 ]; % semilogy(x,y1,'-bo;y1;',x,y2,'-kx;y2;'); % title('Plot title'); % xlabel('X Axis'); % ylabel('Y Axis'); % print -dpng figure.png %__________________________________ % plot([1 2 3],[2 4 6]); % print -dpng figure(1).png % scatter((1:20),rand(1,20)); % print -dpng figure(2).png %__________________________________ % x = 0 : 0.1: 6*pi; % y = sin(x); % plot(x,y) % xlabel('x') ; % ylabel('sin(x)'); % title('Sin(x) graph') % grid on, axis equal % print -dpng figure.png %__________________________________ % x = [0 : 0.1 : 10]; % y = sin(x); % z = cos(x); % plot(x, y,'-bo;y;', x, z,'rx'); % legend('Sin(x)', 'Cos(x)'); % grid on % print -dpng figure(1).png %__________________________________ % x = 0:pi/100:2*pi; % y = sin(x); % plot(x,y,'bo;y;') % hold on % y2 = cos(x); % plot(x,y2,'g--') % legend('sin','cos') % hold off % print -dpng figure.png %__________________________________ % x = [0 : 0.01 : 10]; % y = exp(-x).*sin(2*x + 3); % plot(x,y,'r.-') % axis([0 10 -1 1]) %axis ( [xmin xmax ymin ymax] ) % print -dpng figure.png %__________________________________ % x = [0:0.01:5]; % y = exp(-1.5*x).*sin(10*x); % subplot(1,2,1) % plot(x,y) % xlabel('x') % ylabel('exp(-1.5x)*sin(10x)') % axis([0 5 -1 1]) % print -dpng figure.png % subplot(1,2,2) % plot(x,y) % xlabel('x') % ylabel('exp(–2x)*sin(10x)') % axis([0 5 -1 1]) % print -dpng figure.png %__________________________________ figure(1);hold on;axis off;clf; Nmax=100; % Nombre d iterations X=[];Y=[]; A=[0;0];B=[1;0];C=[0;1]; % On tire un point au hasard x=rand(1);y=rand(1); if (x+y>1),x=x/2;y=y/2;end for bcl=1:Nmax % On choisit le point A, B ou C au hasard tmp=rand(1); if (tmp<1/3) % alors point A x=x/2;y=y/2; elseif (tmp>2/3) % alors point C x=x/2;y=(1+y)/2; else % sinon point B x=(1+x)/2;y=y/2; end X=[X x] Y=[Y y] end plot(X,Y,'b.') print -dpng figure.png % __________________________________
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more