So I am plotting an iterating function for each parameter "a" between a range of values (in this case it's -1.6 to 1.6).
k=20; niter=2^k; % 2^k total iterations
x=zeros(1,niter); y=zeros(1,niter); % filling empty arrays
x1=zeros(1,niter); y1=zeros(1,niter); da=0.2;amin=-1.6; amax=1.6; b=0.3; % a=real and b=imaginary parts of c
for a = amin:da:amax disp(a) x(1)=real(0.5+sqrt(0.25-(a+i*b))); % IC
y(1)=imag(0.5+sqrt(0.25-(a+i*b))); % IC for n=1:niter % iterate
x1=x(n); y1=y(n); u=sqrt((x1-a)^2+(y1-b)^2)/2; v=(x1-a)/2; u1=sqrt(u+v); v1=sqrt(u-v); x(n+1)=u1; y(n+1)=v1; if y(n)<b y(n+1)=-y(n+1); end if rand < .5 % flip a coin
x(n+1)=-u1; y(n+1)=-y(n+1); end end plot(x,y,'k.','MarkerSize',2) hold on;end% PLOT
fsize=15; fsizea=30; % font size of axis and title labels
xlim([-1.6 1.6]); ylim([-1.6 1.6]);axis squarexlabel('Real(z)','FontSize',fsizea)ylabel('Imaginary(z)','FontSize',fsizea)set(gca,'xtick',[-1.6:0.4:1.6],'FontSize',fsize)set(gca,'ytick',[-1.2:0.4:1.2],'FontSize',fsize)title(sprintf('Julia Set for c = %s<a<%s + %s i',num2str(amin,'%1.1d'),num2str(amax,'%1.1d'),num2str(b,'%1.1d')),'FontSize',fsizea)rect = [0,0,260*2.0,260*1.7];set(gcf,'Position',rect);set(gcf,'PaperPositionMode','auto'); c = colorbar;caxis([amin amax])c.Label.String = 'a';
What I want is to have the colorbar represent the range of values of "a", and to have each function that is plotted for each value of "a" to match the color in the colorbar for that value of "a". Here is what the output looks like so far. (This is the default colorbar with the default colors by the way)
Best Answer