No BSD License  

Highlights from
Mandel126

image thumbnail
from Mandel126 by Dr. Jens Koopmann
Animated Mandelbrot set

mandel126(varargin)
function varargout = mandel126(varargin)
% MANDEL126 M-file for mandel126.fig
%{      
      MANDEL123, by itself, creates a new MANDEL123 or raises the existing
      singleton*.

      H = MANDEL123 returns the handle to a new MANDEL123 or the handle to
      the existing singleton*.

      MANDEL123('CALLBACK',hObject,eventData,handles,...) calls the local
      function named CALLBACK in MANDEL123.M with the given input arguments.

      MANDEL123('Property','Value',...) creates a new MANDEL123 or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before mandel126_OpeningFcn gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to mandel126_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

       This program uses a vecorised mandelbrot algorithm (a pretty fast algorithm from
       Lucio Andrade-Cetto which worked great for me.) I tried before the
       Fractal Explorer from Laurant Cavin, but that program was not
       running on my computer.

    This program uses a vectorised Mandelbrot algorithm (a pretty fast algorithm from Lucio Andrade-Cetto which worked great for me.) 
I tried before the Fractal Explorer from Laurant Cavin, but that program was not running on my computer.
 
Usage 

Starting the program

Example1: type mandel123 in the command line and the program will start. It doesnt require any parameters and
the GUI transfers all parameters automatically to its sub routines.

Example2: in case you have trouble in getting mandel123 to work try the second version of the program which 
called mandel_klein in the command line. This program has a smaller GUI and should run on most computers. 

Example3: type GUIDE in the command line and then open mandel123.fig. 
You might have to use the browse function in the GUI window and navigate to the folder where you have downloaded the zipped mandel123 folder. 

Startup Picture
The program always starts with the calculation of the Mandelbrot set with 
the coordinates R(-1.9 0.8) I(1.3 1.28) and it shows a 2D plot of the Mandelbrot set in low resolution.

 
 Creating your on picture
Press on the Zoom button within the View panel. The view will change to a 2D picture in case it was set to 3D. 
Note that the sliders in the Viewing Angle panel are now changed to 0 and 90 and the cursor has changed into a encircled +. 
Press the left mouse button on any position of the Mandelbrot set and then drag the mouse to another position to the left or right. 
You will note that with a slight delay a rectangle will be drawn around the select area and the program will zoom into the area. 
The next step is now to press the Re-calculate button which appeared after selecting the zoom mode and the program will execute a new calculation of the Mandelbrot Set.
The picture will be automatically displayed.

 Saving your picture
Press the save button on right side of the graph and the picture
coordinates and all settings saved. You can recall saved picture by
selecting them in the popupmenu called saved Mandelbrot Sets.

Changing the Resolution
This can be achieved by moving the slider in the Resolution panel on the right side of the GUI. 
Sliding to the right will increase the image resolution and which goes in hand with increased running time of the calculation.
Please note that it is worth to increase the number of iterations as well to achieve the best results. 
It is sometimes best work on a moderate resolution (500- 700) and do all the zooming and change of
viewing angle until happy with the result and then increase the resolution in the last step.

Mandelbrot Set Coordinates
The current coordinates are always displayed in the textboxes on the right side of the GUI. 
Please note that after any zoom action all coordinates, viewing angle etc are also available in the command line interface.
mandel =[0.1872426 0.5715756  0.2568356  0.6411687 700           500 112 15 3  29 70 3]
These values correspond to the program handles: handles.lowerR
handles.higherR
handles.lowerI
handles.higherI
handles.stepsR
handles.stepsI
handles.MaxIter
handles.col,
handles.view
handles.x_view
handles.y_view
handles.light

 Number of Iterations
This value determines how many times the calculation in the dummy2.m function is performed. 
Increasing this number might increase the running time of the program. 
It also can increase the image resolution. It is recommended to vary this parameter on 
the original Mandelbrot set and see which influence this parameter has. 
The effect is more pronounced when zooming deeper into the Mandelbrot Set.

 Viewing Angle
There are three elements in the viewing angle panel that will allow the user to manipulate the aspect ratio off the 3D Mandelbrot set. 
3D Rotate button: clicking on this button changes the appearance off the mouse curser.
Left click and move the mouse and the aspect ratio of the 3D image is going to change and the mouse 
enables you view the Mandelbrot set from any angle just by moving the mouse.

The 2 sliders in the Viewing angle panel enable you to change the viewing angle of the Mandelbrot set. 
In order to experiment with these sliders it is recommended to reduce the Resolution of the picture
and recalculate the current image by pressing the Re-calculate button. 
As a result changes in the aspect ratio happen in real time (depending on your computer of course).

Light effects
There 4 standard Matlab light effects enabled in the mandel123 program. 
Press simply on the four buttons in the Light effects panel. The default setting is Phong.

Chose colour
This program comes with the standard set of Matlab colourmaps as well as four custom colormaps.
Please select them from the Chose colour popupmenu. 

Load Colourmap editor
It is possible to load the standard Matlab colour editor and change the current colormap. 
Once you have changed the 

 Save CMAP
 Press the CMAP button and the current colormap is saved. You can recall
 this colormap in the Chose Colour popup menu. The program automatically
 asigns a name to the colormap.

 Saved Mandelbrot Sets
 
This version of the mandel12x series contains some interesting
pictures from the Mandelbrot Set. Select from the options in the
Saved Mandelbrot Panel menu:
The options are:
Original Mandelbrot Set

 
More scenes are to come. So watch this place. If you know of any
interesting coordinates then please email them to me.

Please note that after any zoom action all coordinates, viewing angle etc are also available in the command line interface.
mandel =[0.1872426 0.5715756  0.2568356  0.6411687 700 500 112 15 3  29 70 3]
These values correspond to the program handles: handles.lowerR
handles.higherR
handles.lowerI
handles.higherI
handles.stepsR
handles.stepsI
handles.MaxIter
handles.col,
handles.view
handles.x_view
handles.y_view
handles.light

You can insert this information directly into the popupmenu2
Function. You have to edit the M code in this section slightly in order to be able to save the coordinates. 
Please ask for help if need be.

Colorcycling
Nice light effect created by displaying several colormaps in rapid
succession.

Axis on/off
The axis values of the current Mandelbrot Set can be displayed or switched
off.

Time for calculation
The time for the calculation of the Mandelbrot Set is displayed in a textbox at the bottom of the GUI.  
Changes since the last version:
 
Textboxes are now updated in the textbox update_function, which
reduces the amount redundant code in the main script.

GUI properties are now controlled and updated from M code. 

Improved documentation (well this just starting).
 
Faster loading of the Mandelbrot set.
 
Save custom colormaps.

Save Mandelbort set with just a mouseclick.

Colorcycling 
I will try to add more functions to the GUI and to improve the
code.
 
Enjoy
 
Any questions or suggestions than drop me a line: jens.koopmann "at" live.com
%}




% See also: GUIDE, GUIDATA, GUIHANDLES
%%
% Edit the above text to modify the response to help mandel126
%%
% Last Modified by GUIDE v2.5 18-Nov-2008 20:17:44

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @mandel126_OpeningFcn, ...
                   'gui_OutputFcn',  @mandel126_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before mandel126 is made visible.
function mandel126_OpeningFcn(hObject, eventdata, handles, varargin)
%function mandel126_OpeningFcn(hObject, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to mandel126 (see VARARGIN)

%Read the size of monitor and adjust the GUI accordingly
scrsz = get(0,'ScreenSize')
h = gcf
set(h,'Position',[10 10 scrsz(3) scrsz(4)]);
%Now create a menu
set(h,'MenuBar','figure');  
%mh = uimenu(h,'Label','My menu');

set(handles.uipanel17,'Visible','off');
set(handles.pushbutton28,'Visible','on');
%set(handles.pushbutton4,'Visible','off');
%set(handles.pushbutton23,'Visible','off');
%Now place all GUI elements according to the screen dimensions
%set(handles.pushbutton1,'Visible','off');
set(handles.uipanel17,'Units','pixels');
set(handles.uipanel17,'Position',[scrsz(3)-460 scrsz(4)-780 410 630]);

%load the names of the colormaps
load 'color_set.mat'
handles.colormap_names=mystrings;
%mystrings
set(handles.popupmenu1,'Visible','on','String',mystrings);
load colmapNumber;
handles.colmapNumber=lastColor;
%Load stored Mandelbrot Set coordinates
load 'mycoordinate.mat'
handles.mandel_coord=mandel_coord;
load 'Mandel_coord_Names'
handles.mandel_Names=mystrings;
mystrings;
set(handles.popupmenu2,'Visible','on','String',mystrings);
% Choose default command line output for mandel126
handles.output = hObject;
handles.col=27;
handles.view=3;
handles.stepsRes=620;
handles.x_view=87;
handles.y_view=70;
handles.MaxIter=620;
handles.stepsI=620;
handles.light=3;
handles.lowerR=-1.75373;
handles.higherR=-1.74239;
handles.lowerI=0.00636182;
handles.higherI=0.0177052;
handles.picture=1;
handles.axis_value=0;

% Set all Sliders according to their handles values
slider_update(handles.slider1,handles.slider8,handles.slider9,handles.slider12,handles.popupmenu1,handles.MaxIter,handles.stepsRes,handles.x_view,handles.y_view,handles.col);
tic
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,0);
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.stepsI,handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,toc);
handles.x=x; handles.y=y; handles.Zvalues=Zvalues;
lastColor=handles.colmapNumber

%colorcycling(handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
%Update all Textbox in the GUI with the current information.
% Update handles structure
guidata(hObject, handles);



% --- Outputs from this function are returned to the command line.
function varargout = mandel126_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject,eventdata,handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
zoom off;
dx=xlim;
dy=ylim;
handles.lowerR=dx(1,1);
handles.higherR=dx(1,2);
%Make sure that the aspect ratio maintains the same.
ddx=handles.higherR-handles.lowerR;
%end    
handles.lowerI=dy(1,1);
handles.higherI=handles.lowerI+ddx;
% Output coordinates to the commandline so that they can be easyly
% transferred into the program in a later stage
handles.x_view=29;
handles.y_view=70;

% Set all Sliders according to their handles values.
slider_update(handles.slider1,handles.slider8,handles.slider9,handles.slider12,handles.popupmenu1,handles.MaxIter,handles.stepsRes,handles.x_view,handles.y_view,handles.col);
space1='['; space2=']';
%t=[handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.stepsI,handles.MaxIter,handles.col,3,handles.x_view,handles.y_view,handles.light];
%Outputting the mandelbrot coordinates and other parameters in the CLI
%mandel=strcat(space1,num2str(t),space2)
%Update all Textbox in the GUI with the current information.
tic
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,0);
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.stepsI,handles.MaxIter,handles.col,3,handles.x_view,handles.y_view,handles.light,handles.axis_value);
time=toc;
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,time);
handles.x=x; handles.y=y; handles.Zvalues=Zvalues;
color_change(handles.col,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
set(handles.pushbutton1,'Visible','off');
% Update handles structure
guidata(hObject, handles);




% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.col=get(hObject,'Value');
handles.col;
color_change(handles.col,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.view=2;
old_x=handles.x_view;
old_y=handles.y_view;
handles.x_view=0;
handles.y_view=90;

% Set all Sliders according to their handles values.
slider_update(handles.slider1,handles.slider8,handles.slider9,handles.slider12,handles.popupmenu1,handles.MaxIter,handles.stepsRes,handles.x_view,handles.y_view,handles.col);
%Update all textboxes
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,0);
%Switch to 2D Mandelbrot set and enable zoom function.
color_change(handles.col,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
handles.x_view=old_x;
handles.y_view=old_y;
set(handles.pushbutton1,'Visible','on');
guidata(hObject, handles);
zoom on;
%guidata(hObject, handles);

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.view=3;
color_change(handles.col,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
zoom off;
guidata(hObject, handles);




% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject    handle to slider1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.MaxIter=get(hObject,'Value');
handles.MaxIter=round(handles.MaxIter*1000);
set(handles.text5,'String',handles.MaxIter);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
%if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
%    set(hObject,'BackgroundColor',[.9 .9 .9]);
%end
usewhitebg = 1;
if usewhitebg
    set(hObject,'BackgroundColor',[.5 .5 .9]);
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end





% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
rotate3d 




% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%[x, y, Zvalues ]=dummy2(-2, 2,-2,2,200,300,30,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
tic
[x,y,Zvalues]=the_fasted_mandel(handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light);
toc

handles.x=x;
handles.y=y;
handles.Zvalues=Zvalues;
guidata(hObject, handles);


% --- Executes on slider movement.
function slider6_Callback(hObject, eventdata, handles)
% hObject    handle to slider6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.x_view=get(hObject,'Value');
handles.x_view=round(handles.x_view*90);
set(handles.text10,'String',handles.x_view);
handles.view
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider7_Callback(hObject, eventdata, handles)
% hObject    handle to slider7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.y_view=get(hObject,'Value');
handles.y_view=round(handles.y_view*90);
set(handles.text11,'String',handles.y_view);
handles.view
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function slider7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



% --- Executes on slider movement.
function slider8_Callback(hObject, eventdata, handles)
% hObject    handle to slider8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.x_view=get(hObject,'Value');
handles.x_view=round(handles.x_view*360);
set(handles.text12,'String',handles.x_view);
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider9_Callback(hObject, eventdata, handles)
% hObject    handle to slider9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.y_view=get(hObject,'Value');
handles.y_view=round(handles.y_view*360);
set(handles.text13,'String',handles.y_view);
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end




% --- Executes on slider movement.
function slider12_Callback(hObject, eventdata, handles)
% hObject    handle to slider12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
handles.stepsRes=get(hObject,'Value');
handles.stepsI=round(40+handles.stepsRes*2000);
set(handles.text15,'String',handles.stepsI);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider12_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton13 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.light=1;
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.light=2;
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.light=3;
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);

% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.light=4;
color_change(handles.col,3,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value);
guidata(hObject, handles);


% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
colormapeditor;
cmap=colormap


% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton19 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
fig=gcf;
load colmapNumber;
MyColorMapsName=strcat('MyColorMaps',num2str(lastColor+1))
Mandelcmap = get(fig,'Colormap')
save('MyColorMapsName','mandelcmap');


% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu2
handles.picture=get(hObject,'Value');
%handover the mandelbrot coordinates from the Handle
mandel=handles.mandel_coord;
handles.lowerR=mandel(handles.picture,1);
handles.higherR=mandel(handles.picture,2);
handles.lowerI=mandel(handles.picture,3);
handles.higherI=mandel(handles.picture,4);
handles.stepsI=mandel(handles.picture,5);
handles.MaxIter=mandel(handles.picture,6);
handles.col=mandel(handles.picture,7);
handles.view=mandel(handles.picture,8);
handles.x_view=mandel(handles.picture,9);
handles.y_view=mandel(handles.picture,10);
handles.light=mandel(handles.picture,11);

% Set all Sliders according to their handles values
slider_update(handles.slider1,handles.slider8,handles.slider9,handles.slider12,handles.popupmenu1,handles.MaxIter,handles.stepsRes,handles.x_view,handles.y_view,handles.col);

%Show a raw wireframe of the zoomed picture and then execute the
%calculation in full resolution.
tic
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,round(handles.stepsI/5),handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
toc
F(1)=getframe;

tic
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.stepsI,handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
time=toc
handles.x=x; handles.y=y; handles.Zvalues=Zvalues;
%Update all Textbox in the GUI with the current information.
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,time);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton21.
function pushbutton21_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton21 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%load the log file that contains the number of saved custom colormaps
load colmapNumber;
handles.colmapNumber=lastColor;
lastColor=lastColor+1
handles.col=12+lastColor;
name2=strcat('MyColorMaps',num2str(lastColor));
mandelcmap=colormap;
save(name2,'mandelcmap');
save('colmapNumber','lastColor');
mystrings=handles.colormap_names;
mystrings1=strcat('mandel',num2str(lastColor));
mystrings=[mystrings mystrings1]
save ('color_set.mat','mystrings')
set(handles.popupmenu1,'Visible','on','String',mystrings);
handles.colormap_names=mystrings;
%mystrings2
set(handles.popupmenu1,'Visible','on','String',mystrings);
guidata(hObject, handles);


% --- Executes on button press in pushbutton23.
function pushbutton23_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton23 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.view=2;
handles.x_view=0;
handles.y_view=90;
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,0);
color_change(handles.col,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
zoom off;
guidata(hObject, handles);


% --- Executes on button press in pushbutton24.
function pushbutton24_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton24 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%handles.axes=1;
handles.axis_value=1;
axis on
if handles.view==3
   axis([ handles.lowerR handles.higherR handles.lowerI handles.higherI 0 handles.MaxIter])
end    
guidata(hObject, handles);

% --- Executes on button press in pushbutton25.
function pushbutton25_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton25 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
axis off
handles.axis_value=0;
guidata(hObject, handles);


% --- Executes on button press in pushbutton26.
function pushbutton26_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton26 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
lastColor=handles.colmapNumber
    iii=0;
    for ii=1 : 20
        iii=iii+1;
        color_change(26+ii,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
        F(iii)=getframe;
    end 
    movie(F,10,4)


% --- Executes on button press in pushbutton27.
function pushbutton27_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton27 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%hand over the mandelbrot coordinates to the variable mandel
mandel=handles.mandel_coord;
%get the size of the array
[m n]=size(mandel);
%write the current mandelbrot set coordinates in array and then save the
%variable
mandel(m+1,1)=handles.lowerR;
mandel(m+1,2)=handles.higherR;
mandel(m+1,3)=handles.lowerI;
mandel(m+1,4)=handles.higherI;
mandel(m+1,5)=handles.stepsI;
mandel(m+1,6)=handles.MaxIter;
mandel(m+1,7)=handles.col;
mandel(m+1,8)=handles.view;
mandel(m+1,9)=handles.x_view;
mandel(m+1,10)=handles.y_view;
mandel(m+1,11)=handles.light;
mandel_coord=mandel;
mystrings=handles.mandel_Names;
mystrings1=strcat('Custom Mandelbt',num2str(m));
mystrings=[mystrings mystrings1]
set(handles.popupmenu2,'Visible','on','String',mystrings);
save('mycoordinate','mandel_coord');
save('Mandel_coord_Names','mystrings');
handles.mandel_coord=mandel;
handles.mandel_Names=mystrings
%Update handles
guidata(hObject, handles);



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object creation, after setting all properties.
function pushbutton18_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object creation, after setting all properties.
function pushbutton26_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton26 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes on button press in pushbutton28.
function pushbutton28_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 iii=0;
    for ii=1 : 20
        ii
        iii=iii+1;
        color_change(26+ii,handles.view,handles.x,handles.y,handles.Zvalues,handles.x_view,handles.y_view,handles.MaxIter,handles.light,handles.axis_value)
        F(iii)=getframe;
    end 
    movie(F,10,4)
    % show normal menu and hide the Animation pushbutton
    set(handles.uipanel17,'Visible','on');
    set(handles.pushbutton28,'Visible','off');
    
    %Load original Mandelbrot picture
    handles.picture=1;
%handover the mandelbrot coordinates from the Handle
mandel=handles.mandel_coord;
handles.lowerR=mandel(handles.picture,1);
handles.higherR=mandel(handles.picture,2);
handles.lowerI=mandel(handles.picture,3);
handles.higherI=mandel(handles.picture,4);
handles.stepsI=mandel(handles.picture,5);
handles.MaxIter=mandel(handles.picture,6);
handles.col=mandel(handles.picture,7);
handles.view=2;
handles.x_view=0;
handles.y_view=90;
handles.light=mandel(handles.picture,11);

% Set all Sliders according to their handles values
slider_update(handles.slider1,handles.slider8,handles.slider9,handles.slider12,handles.popupmenu1,handles.MaxIter,handles.stepsRes,handles.x_view,handles.y_view,handles.col);

%Show a raw wireframe of the zoomed picture and then execute the
%calculation in full resolution.
tic
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,round(handles.stepsI/5),handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
toc
F(1)=getframe;

tic
[x, y, Zvalues]=dummy2 (handles.lowerR, handles.higherR,handles.lowerI,handles.higherI,handles.stepsI,handles.MaxIter,handles.col,handles.view,handles.x_view,handles.y_view,handles.light,handles.axis_value);
time=toc
handles.x=x; handles.y=y; handles.Zvalues=Zvalues;
%Update all Textbox in the GUI with the current information.
textbox_update(handles.text1,handles.text2,handles.text3,handles.text4,handles.text5,handles.text12,handles.text13,handles.text15,handles.text16,handles.lowerR,handles.higherR,handles.lowerI,handles.higherI,handles.MaxIter,handles.x_view,handles.y_view,handles.stepsI,time);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function pushbutton28_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
  

Contact us at files@mathworks.com