// This GUI file is generated by guibuilder version 4.2.1
//////////
clear;
clc;
f=figure('figure_position',[476,49],'figure_size',[841,632],'auto_resize','on','background',[33],'figure_name','Graphic window number %d','dockable','off','infobar_visible','off','toolbar_visible','off','menubar_visible','off','default_axes','on','visible','off');
//////////
handles.dummy = 0;
handles.ax_plot= newaxes();handles.ax_plot.margins = [ 0 0 0 0];handles.ax_plot.axes_bounds = [0.3388525,0.5210145,0.6437179,0.4464399];
handles.editMe1=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe1','Callback','')
handles.editT1=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT1','Callback','')
handles.editMe2=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe2','Callback','')
handles.editT2=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT2','Callback','')
handles.editMe3=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.2,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe3','Callback','')
handles.editT3=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.2,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT3','Callback','')
handles.editOutA5=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.36,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA5','Callback','')
handles.pb_calc1=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.009697,0.6071501,0.1251515,0.0772175],'Relief','default','SliderStep',[0.01,0.1],'String','CALCULATE','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','pb_calc1','Callback','pb_calc1_callback(handles)')
handles.editMe4=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.28,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe4','Callback','')
handles.editT4=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.28,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT4','Callback','')
handles.editMe5=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.36,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe5','Callback','')
handles.editT5=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.36,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT5','Callback','')
handles.editMe6=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.44,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe6','Callback','')
handles.editT6=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.44,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT6','Callback','')
handles.editMe7=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.52,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe7','Callback','')
handles.editT7=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.52,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT7','Callback','')
handles.editMe8=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe8','Callback','')
handles.editT8=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT8','Callback','')
handles.editMe9=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.68,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe9','Callback','')
handles.editT9=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.68,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT9','Callback','')
handles.TitleInputData=uicontrol(f,'unit','normalized','BackgroundColor',[0,0.7,0.15],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[16],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.0081818,0.8567791,0.9839394,0.0490219],'Relief','default','SliderStep',[0.01,0.1],'String','Input data from the measurements','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','TitleInputData','Callback','')
handles.InputTLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.0206061,0.9325464,0.2384848,0.05],'Relief','default','SliderStep',[0.01,0.1],'String',' Estimated time constant T [s]','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','InputTLabel','Callback','')
handles.InputTData=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.269697,0.9376054,0.08,0.0472175],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','InputTData','Callback','')
handles.TitleInputData2=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.041,0.81,0.95,0.036],'Relief','default','SliderStep',[0.01,0.1],'String','     N1             N2             N3            N4             N5             N6             N7             N8             N9           N10           N11           N12','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','TitleInputData2','Callback','')
handles.editMe10=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.76,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe10','Callback','')
handles.editT10=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.76,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT10','Callback','')
handles.editMe11=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.84,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe11','Callback','')
handles.editT11=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.84,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT11','Callback','')
handles.editMe12=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.92,0.73,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMe12','Callback','')
handles.editT12=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.92,0.77,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editT12','Callback','')
handles.XiLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.01,0.77,0.02,0.035],'Relief','default','SliderStep',[0.01,0.1],'String','Xi','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','XiLabel','Callback','')
handles.YiLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.01,0.73,0.02,0.045],'Relief','default','SliderStep',[0.01,0.1],'String','Yi','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','YiLabel','Callback','')
handles.NiLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.01,0.8,0.02,0.045],'Relief','default','SliderStep',[0.01,0.1],'String','Ni','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','NiLabel','Callback','')
handles.TitleOutputData=uicontrol(f,'unit','normalized','BackgroundColor',[0.1,0.7,1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[16],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.3272727,0.6314334,0.6624242,0.0523946],'Relief','default','SliderStep',[0.01,0.1],'String','Predictive calculations','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','TitleOutputData','Callback','')
handles.TitleOutputData2=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.3575758,0.589747,0.6327273,0.0354132],'Relief','default','SliderStep',[0.01,0.1],'String','     N5             N6             N7             N8             N9           N10           N11           N12','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','TitleOutputData2','Callback','')
handles.editOutT5=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.36,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT5','Callback','')
handles.editOutA6=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.44,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA6','Callback','')
handles.editOutT6=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.44,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT6','Callback','')
handles.editOutA7=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.52,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA7','Callback','')
handles.editOutT7=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.52,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT7','Callback','')
handles.editOutA8=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA8','Callback','')
handles.editOutT8=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.6,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT8','Callback','')
handles.editOutA9=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.68,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA9','Callback','')
handles.editOutT9=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.68,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT9','Callback','')
handles.editOutA10=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.76,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA10','Callback','')
handles.editOutT10=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.76,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT10','Callback','')
handles.editOutA11=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.84,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA11','Callback','')
handles.editOutT11=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.84,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT11','Callback','')
handles.editOutA12=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.92,0.547,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutA12','Callback','')
handles.editOutT12=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.92,0.507,0.07,0.04],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editOutT12','Callback','')
handles.AiLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.33,0.54,0.02,0.045],'Relief','default','SliderStep',[0.01,0.1],'String','Ai','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','AiLabel','Callback','')
handles.TiLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.33,0.51,0.02,0.045],'Relief','default','SliderStep',[0.01,0.1],'String','Ti','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','TiLabel','Callback','')
handles.NiLabelOut=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[14],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.33,0.58,0.02,0.045],'Relief','default','SliderStep',[0.01,0.1],'String','Ni','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','NiLabelOut','Callback','')
handles.dXcalcRecommended=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.3960606,0.93086,0.4006061,0.0605902],'Relief','default','SliderStep',[0.01,0.1],'String','Calculate the recommended X1 and increase dX =>','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','dXcalcRecommended','Callback','dXcalcRecommended_callback(handles)')
handles.editdXrecommeded=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.889697,0.9276054,0.07,0.0372175],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editdXrecommeded','Callback','')
handles.editX1recommended=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','left','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.809697,0.9276054,0.07,0.0372175],'Relief','default','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editX1recommended','Callback','')
handles.dXLabel=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.889697,0.9676054,0.07,0.0272175],'Relief','default','SliderStep',[0.01,0.1],'String','dX','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','dXLabel','Callback','')
handles.X1Label=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.809697,0.9676054,0.07,0.0272175],'Relief','default','SliderStep',[0.01,0.1],'String','X1','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','X1Label','Callback','')


f.visible = "on";


//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
//////////
function pb_calc1_callback(handles) //this is callback function of "Calculate" button in the GUI interface
//Write your callback for  pb_calc1  here
//------Here are defined input data text box, which are available in GUI--------
str_Me1 = handles.editMe1.string; //Get the user input from the text box
str_Me2 = handles.editMe2.string;
str_Me3 = handles.editMe3.string;
str_Me4 = handles.editMe4.string;
str_Me5 = handles.editMe5.string;
str_Me6 = handles.editMe6.string;
str_Me7 = handles.editMe7.string;
str_Me8 = handles.editMe8.string;
str_Me9 = handles.editMe9.string;
str_Me10 = handles.editMe10.string;
str_Me11 = handles.editMe11.string;
str_Me12 = handles.editMe12.string;
str_T1 = handles.editT1.string;
str_T2 = handles.editT2.string;
str_T3 = handles.editT3.string;
str_T4 = handles.editT4.string;
str_T5 = handles.editT5.string;
str_T6 = handles.editT6.string;
str_T7 = handles.editT7.string;
str_T8 = handles.editT8.string;
str_T9 = handles.editT9.string;
str_T10 = handles.editT10.string;
str_T11 = handles.editT11.string;
str_T12 = handles.editT12.string;
str_InputTData = handles.InputTData.string;
//------Here the input data is stored in the corresponding variables--------
X1=evstr(str_T1);
X2=evstr(str_T2);
X3=evstr(str_T3);
X4=evstr(str_T4);
X5=evstr(str_T5);
X6=evstr(str_T6);
X7=evstr(str_T7);
X8=evstr(str_T8);
X9=evstr(str_T9);
X10=evstr(str_T10);
X11=evstr(str_T11);
X12=evstr(str_T12);
Y1=evstr(str_Me1);
Y2=evstr(str_Me2);
Y3=evstr(str_Me3);
Y4=evstr(str_Me4);
Y5=evstr(str_Me5);
Y6=evstr(str_Me6);
Y7=evstr(str_Me7);
Y8=evstr(str_Me8);
Y9=evstr(str_Me9);
Y10=evstr(str_Me10);
Y11=evstr(str_Me11);
Y12=evstr(str_Me12);
//------Here is checked if at least 5 data pairs are entered--------
CheckInput=X1*X2*X3*X4*X5*Y1*Y2*Y3*Y4*Y5;
if CheckInput==0 then
    disp('Wrong or not entered data from X1 to X5 and / or from Y1 to Y5!')
else
//------Here initial Bn is calculated as it is additionally increased by 50% to guarantee a negative initial value of function F3--------
Bn=1.5/evstr(str_InputTData);
//Izchisliavame F3 kato polzvame Bn. Zapisvame stoinostite B1 i F31 pri koito F3 e otricatelno no nai blizko do 0, kakto B2 i F32 pri F3 polijitelno.
//------Here F3 is calculate with using of Bn initially. Variables B1 and F31 record the corresponding data for which the function F3 is negative but closest to 0.--------
for i=1:0.5:95 do   //about 190 rotations of the for loop are made here, each time Bn is reduced by 0.5% until the function F3 becomes positive.
Bn1=Bn-(Bn*(i/100));
BnM(i)=[Bn1];      //used when debugging along with the code below: disp(BnM)

//------CALC A5 and T5 Temporary--------
S1a5=(Y1*(1-exp(-Bn1*X1)))+(Y2*(1-exp(-Bn1*X2)))+(Y3*(1-exp(-Bn1*X3)))+(Y4*(1-exp(-Bn1*X4)))+(Y5*(1-exp(-Bn1*X5)));
S1a5M(i)=[S1a5];        //used when debugging along with the code below: disp(S1a5M)
S2a5=(1-exp(-Bn1*X1))^2+(1-exp(-Bn1*X2))^2+(1-exp(-Bn1*X3))^2+(1-exp(-Bn1*X4))^2+(1-exp(-Bn1*X5))^2;
S2a5M(i)=[S2a5];        //used when debugging along with the code below: disp(S2a5M)
Sa5M=[S1a5M,S2a5M];     //used when debugging along with the code below: disp(Sa5M)
Aa5=S1a5/S2a5;
Aa5M(i)=[Aa5];          //used when debugging along with the code below: disp(Aa5M)
F3a5=(Aa5*X1*exp(-Bn1*X1)*(Y1+Aa5*(exp(-Bn1*X1)-1)))+(Aa5*X2*exp(-Bn1*X2)*(Y2+Aa5*(exp(-Bn1*X2)-1)))+(Aa5*X3*exp(-Bn1*X3)*(Y3+Aa5*(exp(-Bn1*X3)-1)))+(Aa5*X4*exp(-Bn1*X4)*(Y4+Aa5*(exp(-Bn1*X4)-1)))+(Aa5*X5*exp(-Bn1*X5)*(Y5+Aa5*(exp(-Bn1*X5)-1)));
F3a5M(i)=[F3a5];        //used when debugging along with the code below: disp(F3a5M)
if F3a5<0 then
    B1a5=Bn1;
    F31a5=F3a5;
else
    B2a5=B1a5+(Bn*(i/100));
    S1a5=(Y1*(1-exp(-B2a5*X1)))+(Y2*(1-exp(-B2a5*X2)))+(Y3*(1-exp(-B2a5*X3)))+(Y4*(1-exp(-B2a5*X4)))+(Y5*(1-exp(-B2a5*X5)));
    S2a5=(1-exp(-B2a5*X1))^2+(1-exp(-B2a5*X2))^2+(1-exp(-B2a5*X3))^2+(1-exp(-B2a5*X4))^2+(1-exp(-B2a5*X5))^2;
    Aa5=S1a5/S2a5;
    F32a5=(Aa5*X1*exp(-B2a5*X1)*(Y1+Aa5*(exp(-B2a5*X1)-1)))+(Aa5*X2*exp(-B2a5*X2)*(Y2+Aa5*(exp(-B2a5*X2)-1)))+(Aa5*X3*exp(-B2a5*X3)*(Y3+Aa5*(exp(-B2a5*X3)-1)))+(Aa5*X4*exp(-B2a5*X4)*(Y4+Aa5*(exp(-B2a5*X4)-1)))+(Aa5*X5*exp(-B2a5*X5)*(Y5+Aa5*(exp(-B2a5*X5)-1)));
end
//------CALC A6 and T6 Temporary--------
    S1a6=(Y1*(1-exp(-Bn1*X1)))+(Y2*(1-exp(-Bn1*X2)))+(Y3*(1-exp(-Bn1*X3)))+(Y4*(1-exp(-Bn1*X4)))+(Y5*(1-exp(-Bn1*X5)))+(Y6*(1-exp(-Bn1*X6)));
    S2a6=(1-exp(-Bn1*X1))^2+(1-exp(-Bn1*X2))^2+(1-exp(-Bn1*X3))^2+(1-exp(-Bn1*X4))^2+(1-exp(-Bn1*X5))^2+(1-exp(-Bn1*X6))^2;
    Aa6=S1a6/S2a6;
    F3a6=(Aa6*X1*exp(-Bn1*X1)*(Y1+Aa6*(exp(-Bn1*X1)-1)))+(Aa6*X2*exp(-Bn1*X2)*(Y2+Aa6*(exp(-Bn1*X2)-1)))+(Aa6*X3*exp(-Bn1*X3)*(Y3+Aa6*(exp(-Bn1*X3)-1)))+(Aa6*X4*exp(-Bn1*X4)*(Y4+Aa6*(exp(-Bn1*X4)-1)))+(Aa6*X5*exp(-Bn1*X5)*(Y5+Aa6*(exp(-Bn1*X5)-1)))+(Aa6*X6*exp(-Bn1*X6)*(Y6+Aa6*(exp(-Bn1*X6)-1)));
    if F3a6<0 then
        B1a6=Bn1;
        F31a6=F3a6;
    else
        B2a6=B1a6+(Bn*(i/100));
        S1a6=(Y1*(1-exp(-B2a6*X1)))+(Y2*(1-exp(-B2a6*X2)))+(Y3*(1-exp(-B2a6*X3)))+(Y4*(1-exp(-B2a6*X4)))+(Y5*(1-exp(-B2a6*X5)))+(Y6*(1-exp(-B2a6*X6)));
        S2a6=(1-exp(-B2a6*X1))^2+(1-exp(-B2a6*X2))^2+(1-exp(-B2a6*X3))^2+(1-exp(-B2a6*X4))^2+(1-exp(-B2a6*X5))^2+(1-exp(-B2a6*X6))^2;
        Aa6=S1a6/S2a6;
        F32a6=(Aa6*X1*exp(-B2a6*X1)*(Y1+Aa6*(exp(-B2a6*X1)-1)))+(Aa6*X2*exp(-B2a6*X2)*(Y2+Aa6*(exp(-B2a6*X2)-1)))+(Aa6*X3*exp(-B2a6*X3)*(Y3+Aa6*(exp(-B2a6*X3)-1)))+(Aa6*X4*exp(-B2a6*X4)*(Y4+Aa6*(exp(-B2a6*X4)-1)))+(Aa6*X5*exp(-B2a6*X5)*(Y5+Aa6*(exp(-B2a6*X5)-1)))+(Aa6*X6*exp(-B2a6*X6)*(Y6+Aa6*(exp(-B2a6*X6)-1)));
    end
//------CALC A7 and T7 Temporary--------
S1a7=(Y1*(1-exp(-Bn1*X1)))+(Y2*(1-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-exp(-Bn1*X10))^2;
Aa10=S1a10/S2a10;
F3a10=(Aa10*X1*exp(-Bn1*X1)*(Y1+Aa10*(exp(-Bn1*X1)-1)))+(Aa10*X2*exp(-Bn1*X2)*(Y2+Aa10*(exp(-Bn1*X2)-1)))+(Aa10*X3*exp(-Bn1*X3)*(Y3+Aa10*(exp(-Bn1*X3)-1)))+(Aa10*X4*exp(-Bn1*X4)*(Y4+Aa10*(exp(-Bn1*X4)-1)))+(Aa10*X5*exp(-Bn1*X5)*(Y5+Aa10*(exp(-Bn1*X5)-1)))+(Aa10*X6*exp(-Bn1*X6)*(Y6+Aa10*(exp(-Bn1*X6)-1)))+(Aa10*X7*exp(-Bn1*X7)*(Y7+Aa10*(exp(-Bn1*X7)-1)))+(Aa10*X8*exp(-Bn1*X8)*(Y8+Aa10*(exp(-Bn1*X8)-1)))+(Aa10*X9*exp(-Bn1*X9)*(Y9+Aa10*(exp(-Bn1*X9)-1)))+(Aa10*X10*exp(-Bn1*X10)*(Y10+Aa10*(exp(-Bn1*X10)-1)));
if F3a10<0 then
    B1a10=Bn1;
    F31a10=F3a10;
else
    B2a10=B1a10+(Bn*(i/100));
    S1a10=(Y1*(1-exp(-B2a10*X1)))+(Y2*(1-exp(-B2a10*X2)))+(Y3*(1-exp(-B2a10*X3)))+(Y4*(1-exp(-B2a10*X4)))+(Y5*(1-exp(-B2a10*X5)))+(Y6*(1-exp(-B2a10*X6)))+(Y7*(1-exp(-B2a10*X7)))+(Y8*(1-exp(-B2a10*X8)))+(Y9*(1-exp(-B2a10*X9)))+(Y10*(1-exp(-B2a10*X10)));
    S2a10=(1-exp(-B2a10*X1))^2+(1-exp(-B2a10*X2))^2+(1-exp(-B2a10*X3))^2+(1-exp(-B2a10*X4))^2+(1-exp(-B2a10*X5))^2+(1-exp(-B2a10*X6))^2+(1-exp(-B2a10*X7))^2+(1-exp(-B2a10*X8))^2+(1-exp(-B2a10*X9))^2+(1-exp(-B2a10*X10))^2;
    Aa10=S1a10/S2a10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(-B2a11*X11))^2;
    Aa11=S1a11/S2a11;
    F32a11=(Aa11*X1*exp(-B2a11*X1)*(Y1+Aa11*(exp(-B2a11*X1)-1)))+(Aa11*X2*exp(-B2a11*X2)*(Y2+Aa11*(exp(-B2a11*X2)-1)))+(Aa11*X3*exp(-B2a11*X3)*(Y3+Aa11*(exp(-B2a11*X3)-1)))+(Aa11*X4*exp(-B2a11*X4)*(Y4+Aa11*(exp(-B2a11*X4)-1)))+(Aa11*X5*exp(-B2a11*X5)*(Y5+Aa11*(exp(-B2a11*X5)-1)))+(Aa11*X6*exp(-B2a11*X6)*(Y6+Aa11*(exp(-B2a11*X6)-1)))+(Aa11*X7*exp(-B2a11*X7)*(Y7+Aa11*(exp(-B2a11*X7)-1)))+(Aa11*X8*exp(-B2a11*X8)*(Y8+Aa11*(exp(-B2a11*X8)-1)))+(Aa11*X9*exp(-B2a11*X9)*(Y9+Aa11*(exp(-B2a11*X9)-1)))+(Aa11*X10*exp(-B2a11*X10)*(Y10+Aa11*(exp(-B2a11*X10)-1)))+(Aa11*X11*exp(-B2a11*X11)*(Y11+Aa11*(exp(-B2a11*X11)-1)));
end
//------CALC A12 and T12 Temporary--------
S1a12=(Y1*(1-exp(-Bn1*X1)))+(Y2*(1-exp(-Bn1*X2)))+(Y3*(1-exp(-Bn1*X3)))+(Y4*(1-exp(-Bn1*X4)))+(Y5*(1-exp(-Bn1*X5)))+(Y6*(1-exp(-Bn1*X6)))+(Y7*(1-exp(-Bn1*X7)))+(Y8*(1-exp(-Bn1*X8)))+(Y9*(1-exp(-Bn1*X9)))+(Y10*(1-exp(-Bn1*X10)))+(Y11*(1-exp(-Bn1*X11)))+(Y12*(1-exp(-Bn1*X12)));
S2a12=(1-exp(-Bn1*X1))^2+(1-exp(-Bn1*X2))^2+(1-exp(-Bn1*X3))^2+(1-exp(-Bn1*X4))^2+(1-exp(-Bn1*X5))^2+(1-exp(-Bn1*X6))^2+(1-exp(-Bn1*X7))^2+(1-exp(-Bn1*X8))^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    S2a12=(1-exp(-B2a12*X1))^2+(1-exp(-B2a12*X2))^2+(1-exp(-B2a12*X3))^2+(1-exp(-B2a12*X4))^2+(1-exp(-B2a12*X5))^2+(1-exp(-B2a12*X6))^2+(1-exp(-B2a12*X7))^2+(1-exp(-B2a12*X8))^2+(1-exp(-B2a12*X9))^2+(1-exp(-B2a12*X10))^2+(1-exp(-B2a12*X11))^2+(1-exp(-B2a12*X12))^2;
    Aa12=S1a12/S2a12;
    F32a12=(Aa12*X1*exp(-B2a12*X1)*(Y1+Aa12*(exp(-B2a12*X1)-1)))+(Aa12*X2*exp(-B2a12*X2)*(Y2+Aa12*(exp(-B2a12*X2)-1)))+(Aa12*X3*exp(-B2a12*X3)*(Y3+Aa12*(exp(-B2a12*X3)-1)))+(Aa12*X4*exp(-B2a12*X4)*(Y4+Aa12*(exp(-B2a12*X4)-1)))+(Aa12*X5*exp(-B2a12*X5)*(Y5+Aa12*(exp(-B2a12*X5)-1)))+(Aa12*X6*exp(-B2a12*X6)*(Y6+Aa12*(exp(-B2a12*X6)-1)))+(Aa12*X7*exp(-B2a12*X7)*(Y7+Aa12*(exp(-B2a12*X7)-1)))+(Aa12*X8*exp(-B2a12*X8)*(Y8+Aa12*(exp(-B2a12*X8)-1)))+(Aa12*X9*exp(-B2a12*X9)*(Y9+Aa12*(exp(-B2a12*X9)-1)))+(Aa12*X10*exp(-B2a12*X10)*(Y10+Aa12*(exp(-B2a12*X10)-1)))+(Aa12*X11*exp(-B2a12*X11)*(Y11+Aa12*(exp(-B2a12*X11)-1)))+(Aa12*X12*exp(-B2a12*X12)*(Y12+Aa12*(exp(-B2a12*X12)-1)));
end

end  // end of the for cicle.

///////////////////////////////////////////////////
//This part is used to find errors in formulas:
disp('Bn initial')
disp(BnM)
disp('S1a5 calculation with Bn')
disp(S1a5M)
disp('S2a5 calculation with Bn')
disp(S2a5M)
disp('Sa5 calculation with Bn')
disp(Sa5M)
disp('Aa5 calculation with S1a5/S2a5')
disp(Aa5M)
disp('F3a5 calculation')
disp(F3a5M)
////////////////////////////////////////////////////

//-------------------------------
//CALC A5 and T5 - FINAL
//--------
B0a5=B2a5+((B1a5-B2a5)/(1-(F31a5/F32a5)));
S1a5=(Y1*(1-exp(-B0a5*X1)))+(Y2*(1-exp(-B0a5*X2)))+(Y3*(1-exp(-B0a5*X3)))+(Y4*(1-exp(-B0a5*X4)))+(Y5*(1-exp(-B0a5*X5)));
S2a5=(1-exp(-B0a5*X1))^2+(1-exp(-B0a5*X2))^2+(1-exp(-B0a5*X3))^2+(1-exp(-B0a5*X4))^2+(1-exp(-B0a5*X5))^2;
Aa5=S1a5/S2a5;
Ta5=1/B0a5;
handles.editOutA5.string = string(Aa5);
handles.editOutT5.string = string(Ta5);
//-------------------------------
//CALC A6 and T6 - FINAL
//--------
if (X6*Y6)>0 then
    B0a6=B2a6+((B1a6-B2a6)/(1-(F31a6/F32a6)));
    S1a6=(Y1*(1-exp(-B0a6*X1)))+(Y2*(1-exp(-B0a6*X2)))+(Y3*(1-exp(-B0a6*X3)))+(Y4*(1-exp(-B0a6*X4)))+(Y5*(1-exp(-B0a6*X5)))+(Y6*(1-exp(-B0a6*X6)));
    S2a6=(1-exp(-B0a6*X1))^2+(1-exp(-B0a6*X2))^2+(1-exp(-B0a6*X3))^2+(1-exp(-B0a6*X4))^2+(1-exp(-B0a6*X5))^2+(1-exp(-B0a6*X6))^2;
    Aa6=S1a6/S2a6;
    Ta6=1/B0a6;
    handles.editOutA6.string = string(Aa6);
    handles.editOutT6.string = string(Ta6);
end
//-------------------------------
//CALC A7 and T7 - FINAL
//--------
if (X7*Y7)>0 then
    B0a7=B2a7+((B1a7-B2a7)/(1-(F31a7/F32a7)));
    S1a7=(Y1*(1-exp(-B0a7*X1)))+(Y2*(1-exp(-B0a7*X2)))+(Y3*(1-exp(-B0a7*X3)))+(Y4*(1-exp(-B0a7*X4)))+(Y5*(1-exp(-B0a7*X5)))+(Y6*(1-exp(-B0a7*X6)))+(Y7*(1-exp(-B0a7*X7)));
    S2a7=(1-exp(-B0a7*X1))^2+(1-exp(-B0a7*X2))^2+(1-exp(-B0a7*X3))^2+(1-exp(-B0a7*X4))^2+(1-exp(-B0a7*X5))^2+(1-exp(-B0a7*X6))^2+(1-exp(-B0a7*X7))^2;
    Aa7=S1a7/S2a7;
    Ta7=1/B0a7;
    handles.editOutA7.string = string(Aa7);
    handles.editOutT7.string = string(Ta7);
end
//-------------------------------
//CALC A8 and T8 - FINAL
//--------
if (X8*Y8)>0 then
    B0a8=B2a8+((B1a8-B2a8)/(1-(F31a8/F32a8)));
    S1a8=(Y1*(1-exp(-B0a8*X1)))+(Y2*(1-exp(-B0a8*X2)))+(Y3*(1-exp(-B0a8*X3)))+(Y4*(1-exp(-B0a8*X4)))+(Y5*(1-exp(-B0a8*X5)))+(Y6*(1-exp(-B0a8*X6)))+(Y7*(1-exp(-B0a8*X7)))+(Y8*(1-exp(-B0a8*X8)));
    S2a8=(1-exp(-B0a8*X1))^2+(1-exp(-B0a8*X2))^2+(1-exp(-B0a8*X3))^2+(1-exp(-B0a8*X4))^2+(1-exp(-B0a8*X5))^2+(1-exp(-B0a8*X6))^2+(1-exp(-B0a8*X7))^2+(1-exp(-B0a8*X8))^2;
    Aa8=S1a8/S2a8;
    Ta8=1/B0a8;
    handles.editOutA8.string = string(Aa8);
    handles.editOutT8.string = string(Ta8);
end
//-------------------------------
//CALC A9 and T9 - FINAL
//--------
if (X9*Y9)>0 then
    B0a9=B2a9+((B1a9-B2a9)/(1-(F31a9/F32a9)));
    S1a9=(Y1*(1-exp(-B0a9*X1)))+(Y2*(1-exp(-B0a9*X2)))+(Y3*(1-exp(-B0a9*X3)))+(Y4*(1-exp(-B0a9*X4)))+(Y5*(1-exp(-B0a9*X5)))+(Y6*(1-exp(-B0a9*X6)))+(Y7*(1-exp(-B0a9*X7)))+(Y8*(1-exp(-B0a9*X8)))+(Y9*(1-exp(-B0a9*X9)));
    S2a9=(1-exp(-B0a9*X1))^2+(1-exp(-B0a9*X2))^2+(1-exp(-B0a9*X3))^2+(1-exp(-B0a9*X4))^2+(1-exp(-B0a9*X5))^2+(1-exp(-B0a9*X6))^2+(1-exp(-B0a9*X7))^2+(1-exp(-B0a9*X8))^2+(1-exp(-B0a9*X9))^2;
    Aa9=S1a9/S2a9;
    Ta9=1/B0a9;
    handles.editOutA9.string = string(Aa9);
    handles.editOutT9.string = string(Ta9);
end
//-------------------------------
//CALC A10 and T10 - FINAL
//--------
if (X10*Y10)>0 then
    B0a10=B2a10+((B1a10-B2a10)/(1-(F31a10/F32a10)));
    S1a10=(Y1*(1-exp(-B0a10*X1)))+(Y2*(1-exp(-B0a10*X2)))+(Y3*(1-exp(-B0a10*X3)))+(Y4*(1-exp(-B0a10*X4)))+(Y5*(1-exp(-B0a10*X5)))+(Y6*(1-exp(-B0a10*X6)))+(Y7*(1-exp(-B0a10*X7)))+(Y8*(1-exp(-B0a10*X8)))+(Y9*(1-exp(-B0a10*X9)))+(Y10*(1-exp(-B0a10*X10)));
    S2a10=(1-exp(-B0a10*X1))^2+(1-exp(-B0a10*X2))^2+(1-exp(-B0a10*X3))^2+(1-exp(-B0a10*X4))^2+(1-exp(-B0a10*X5))^2+(1-exp(-B0a10*X6))^2+(1-exp(-B0a10*X7))^2+(1-exp(-B0a10*X8))^2+(1-exp(-B0a10*X9))^2+(1-exp(-B0a10*X10))^2;
    Aa10=S1a10/S2a10;
    Ta10=1/B0a10;
    handles.editOutA10.string = string(Aa10);
    handles.editOutT10.string = string(Ta10);
end
//-------------------------------
//CALC A11 and T11 - FINAL
//--------
if (X11*Y11)>0 then
    B0a11=B2a11+((B1a11-B2a11)/(1-(F31a11/F32a11)));
    S1a11=(Y1*(1-exp(-B0a11*X1)))+(Y2*(1-exp(-B0a11*X2)))+(Y3*(1-exp(-B0a11*X3)))+(Y4*(1-exp(-B0a11*X4)))+(Y5*(1-exp(-B0a11*X5)))+(Y6*(1-exp(-B0a11*X6)))+(Y7*(1-exp(-B0a11*X7)))+(Y8*(1-exp(-B0a11*X8)))+(Y9*(1-exp(-B0a11*X9)))+(Y10*(1-exp(-B0a11*X10)))+(Y11*(1-exp(-B0a11*X11)));
    S2a11=(1-exp(-B0a11*X1))^2+(1-exp(-B0a11*X2))^2+(1-exp(-B0a11*X3))^2+(1-exp(-B0a11*X4))^2+(1-exp(-B0a11*X5))^2+(1-exp(-B0a11*X6))^2+(1-exp(-B0a11*X7))^2+(1-exp(-B0a11*X8))^2+(1-exp(-B0a11*X9))^2+(1-exp(-B0a11*X10))^2+(1-exp(-B0a11*X11))^2;
    Aa11=S1a11/S2a11;
    Ta11=1/B0a11;
    handles.editOutA11.string = string(Aa11);
    handles.editOutT11.string = string(Ta11);
end
//-------------------------------
//CALC A12 and T12 - FINAL
//--------
if (X12*Y12)>0 then
   B0a12=B2a12+((B1a12-B2a12)/(1-(F31a12/F32a12)));
    S1a12=(Y1*(1-exp(-B0a12*X1)))+(Y2*(1-exp(-B0a12*X2)))+(Y3*(1-exp(-B0a12*X3)))+(Y4*(1-exp(-B0a12*X4)))+(Y5*(1-exp(-B0a12*X5)))+(Y6*(1-exp(-B0a12*X6)))+(Y7*(1-exp(-B0a12*X7)))+(Y8*(1-exp(-B0a12*X8)))+(Y9*(1-exp(-B0a12*X9)))+(Y10*(1-exp(-B0a12*X10)))+(Y11*(1-exp(-B0a12*X11)))+(Y12*(1-exp(-B0a12*X12)));
    S2a12=(1-exp(-B0a12*X1))^2+(1-exp(-B0a12*X2))^2+(1-exp(-B0a12*X3))^2+(1-exp(-B0a12*X4))^2+(1-exp(-B0a12*X5))^2+(1-exp(-B0a12*X6))^2+(1-exp(-B0a12*X7))^2+(1-exp(-B0a12*X8))^2+(1-exp(-B0a12*X9))^2+(1-exp(-B0a12*X10))^2+(1-exp(-B0a12*X11))^2+(1-exp(-B0a12*X12))^2;
    Aa12=S1a12/S2a12;
    Ta12=1/B0a12;
    handles.editOutA12.string = string(Aa12);
    handles.editOutT12.string = string(Ta12);
end

end // end of if CheckInput==0.

//------Here a special approcsimation function is applied over the final calculated data and is ploted in GUI--------
if (X12*Y12)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7), evstr(Aa8), evstr(Aa9), evstr(Aa10), evstr(Aa11), evstr(Aa12)]';
    tm2 = [100, 100, 100, 100, 100, 100, 100, 100]';
    ym1 = [5, 6, 7, 8, 9, 10, 11, 12]';
    delete(handles.ax_plot.children);
    m = 700;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,12,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
    
elseif (X11*Y11)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7), evstr(Aa8), evstr(Aa9), evstr(Aa10), evstr(Aa11)]';
    tm2 = [100, 100, 100, 100, 100, 100, 100]';
    ym1 = [5, 6, 7, 8, 9, 10, 11]';
    delete(handles.ax_plot.children);
    m = 600;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,11,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X10*Y10)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7), evstr(Aa8), evstr(Aa9), evstr(Aa10)]';
    tm2 = [100, 100, 100, 100, 100, 100]';
    ym1 = [5, 6, 7, 8, 9, 10]';
    delete(handles.ax_plot.children);
    m = 500;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,10,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X9*Y9)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7), evstr(Aa8), evstr(Aa9)]';
    tm2 = [100, 100, 100, 100, 100]';
    ym1 = [5, 6, 7, 8, 9]';
    delete(handles.ax_plot.children);
    m = 400;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,9,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X8*Y8)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7), evstr(Aa8)]';
    tm2 = [100, 100, 100, 100]';
    ym1 = [5, 6, 7, 8]';
    delete(handles.ax_plot.children);
    m = 300;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,8,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X7*Y7)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6), evstr(Aa7)]';
    tm2 = [100, 100, 100]';
    ym1 = [5, 6, 7]';
    delete(handles.ax_plot.children);
    m = 200;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,7,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X6*Y6)<>0 then
    tm1 = [evstr(Aa5), evstr(Aa6)]';
    tm2 = [100, 100]';
    ym1 = [5, 6]';
    delete(handles.ax_plot.children);
    m = 100;             // discretization for evaluation
    x = ym1;
    y = tm1;
    xx = linspace(5,6,m)';
    ym = interp(xx, x, y, splin(x,y,"monotone"));
    plot(xx,ym,'b-')
    plot(x,y,'k*')
    //plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
elseif (X5*Y5)<>0 then
    tm1 = [evstr(Aa5)]';
    tm2 = [100]';
    ym1 = [5]';
    delete(handles.ax_plot.children);
    plot(ym1,tm1,'b-*')
    plot(ym1, tm2, "r--")
end

endfunction  //end of the function pb_calc1_callback 

//------Function that calculate the recommended X1 and increase step dX--------
function dXcalcRecommended_callback(handles)
//Write your callback for  dXcalcRecommended  here
str_InputTData = handles.InputTData.string;
calc_X1 = 0.5*evstr(str_InputTData);
calc_dX = 0.05*evstr(str_InputTData);
handles.editX1recommended.string = string(calc_X1);
handles.editdXrecommeded.string = string(calc_dX);
endfunction
