Found a research paper on Supersonic nozzles with code for designing an optimized one. Need some help with the code.

title in paper is Code for GUI construction. it's long so will be in two parts

function varargout = DeLavalNozzle(varargin) % DELAVALNOZZLE M-file for DeLavalNozzle.fig % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @DeLavalNozzle_OpeningFcn, ... 'gui_OutputFcn', @DeLavalNozzle_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 DeLavalNozzle is made visible. function DeLavalNozzle_OpeningFcn(hObject, eventdata, handles, varargin) %Initilizing of particle properties handles.SigmaTS = 0; %data structure for storing tensible strength handles.rhop = 0; %data structure for storing particle velocity handles.Cpp = 0; %data structure for storing specific heat of particle handles.Tm = 0; %data structure for storing particle melting temperature handles.F1 = 0; %data structure for storing the mechanical calibration %factor handles.F2 = 0; %data structure for storing the thermal calibration factor %Initializing gas properties handles.rhog = 0; %data structure for storing gas density handles.R = 0; %data structure for storing gas constant handles.gam = 0; %data structure for storing specific heat ratio % Choose default command line output for DeLavalNozzle handles.output = hObject; % Update handles structure guidata(hObject, handles); function varargout = DeLavalNozzle_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; function T0_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function T0_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'),... get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in Compute. function Compute_Callback(hObject, eventdata, handles) %-------------------------INPUT DATA------------------------------------ %-------------------------Data Gas from m.files------------------------- %gam, specific heat ratio %R, universal gas constant [J/kg K] %-------------------------Data Particles from m.files------------------- %SigmaTS, storing tensible strength [Pa] %rhop, particle velocity [kg/s] %vp, particle velocity [kg/m3] %Cpp, specific heat of particle [J/kg K] %Tm, particle melting temperature [K] %F1, mechanical calibration factor %F2, thermal calibration factor %-------------------------Atmospheric Conditions----------------------- AtmP = str2num(get(handles.AtmP,'String')); %atmospheric pressure [MPa] AtmT = str2num(get(handles.AtmT,'String')); % atmosheric temperature [K] %------------------------Data nozzle form interface--------------------- dstar = str2num(get(handles.dstar,'String')); %throat diameter de = str2num(get(handles.de,'String')); %exit diameter x = str2num(get(handles.x,'String')); %length divergent part %-------------------------Data gas from interface----------------------- T0 = str2num(get(handles.T0,'String')); %stagnation temperature [K] P0 = str2num(get(handles.P0,'String')); %stagnation pressure [MPa] %-------------------------Data Particles form interface----------------- Dp = str2num(get(handles.Dp,'String')); %particle diameter [Micron] Ti = str2num(get(handles.Ti,'String')); %Impact temperature [293.15K] Tih = str2num(get(handles.Tih,'String')); %Impact temperature [373.15K] %--------------------------CALCULATIONS--------------------------------- Astar = (3.14dstar2)/4; %throat area [mm2]; Ae = (3.14de2)/4; %exit area [mm2]; Tstar = T0 / (1+(handles.gam-1)/2); %temperature at throat [K] Vstar = (handles.gamhandles.RTstar)1/2; %velocity at throat [m/s] rho0 = (P0106)/(handles.RT0); %stagnation density [kg/m3] rhostar = rho0(2/(handles.gam+1))1/(handles.gam-1);... %sonic gas density [kg/m3] Pstar = (rhostar * handles.R * Tstar)/106; %pressure at throat [MPa] mvdot =(2/(handles.gam+1))1/(handles.gam-1)VstarAstar10-63600;... %gas flow rate [m3/hour] AreaRatio = Ae / Astar; %area ratio k1 = 218.0629 - 243.5764handles.gam + 71.7925handles.gam2; %constant k2 = -0.122450 + 0.281300handles.gam; %constant Me = (k1AreaRatio + (1-k1))k2; %Mach number from Area ratio Pe = Pstar((handles.gam+1)/(2+(handles.gam-1)Me2))^(handles.gam/... (handles.gam-1)); %pressure at exit [MPa] Te = T0 / (1+((handles.gam-1)/2)Me2); %temperature at exit [K] Ve = Me * (handles.gamhandles.RTe)0.5; %velocity of gas at exit [m/s] rhoe = (rhostar((handles.gam+1)/2)1/(handles.gam-1)) /... ((1+((handles.gam-1)/2)Me2)1/(handles.gam-1));... %exit gas density [kg/m3] Vp = Ve / (1+0.85* sqrt(Dp/(x103)) * sqrt(handles.rhopVe2/(P0*106))); TR = AtmT; %reference temperature [K] VcritL =sqrt((handles.F14handles.SigmaTS(1-(Ti-TR)/(handles.Tm-TR)))... /handles.rhop + handles.F2handles.Cpp(handles.Tm - Ti));... %critical velocity [m/s] VcritH =sqrt((handles.F14handles.SigmaTS(1-(Tih-TR)/(handles.Tm-TR)))... /handles.rhop + handles.F2handles.Cpp(handles.Tm - Tih));... %critical velocity [m/s] Ps = Pe((((2handles.gam)/(handles.gam+1))(Me2))-((handles.gam-1)/... (handles.gam+1))); %shock pressure [MPa] %----------------------------OUTPUT RESULTS------------------------------- set(handles.mvdot,'String',mvdot); set(handles.Tstar,'String',Tstar); set(handles.Vstar,'String',Vstar); set(handles.rhostar,'String',rhostar); set(handles.Pstar,'String',Pstar); set(handles.AreaRatio,'String',AreaRatio); set(handles.Me,'String',Me); set(handles.Pe,'String',Pe); set(handles.Te,'String',Te); set(handles.Ve,'String',Ve); set(handles.rhoe,'String',rhoe); set(handles.Ps,'String',Ps); set(handles.Vp,'String',Vp); set(handles.VcritL,'String',VcritL); set(handles.VcritH,'String',VcritH); %---------------------Plot Particle Velocity----------------------------- %var(), mean variation of() Varx = 0:.01:x; %VarVp = Ve . ((3.1.rhoe.Varx.10.-3)./... %(2.Dp.10-6.handles.rhop)).0.5; VarVp = Ve ./ (1.+0.85.(Dp./(Varx.10.3)).0.5.(handles.rhop.Ve.2./... (P0.10.6)).0.5); axes(handles.PlotAxe1); plot(Varx,VarVp,'r','LineWidth',2); xlabel('Divergent Length (mm) vs Particle Velocity (m/s)'); grid %---------------Plot Pressure and Temperature superimposed--------------- VarMe = [1:.01:Me]; VarPe = Pstar.((handles.gam+1)./(2.+(handles.gam-1).VarMe.2)).... (handles.gam ./(handles.gam-1)); VarTe = T0 ./ (1.+((handles.gam-1)/2).*VarMe.2); axes(handles.PlotAxe2); plotyy(VarMe,VarPe,VarMe,VarTe),... title('Mach number vs Pressure(blue) and Mach number vs Temperature(gren)') xlabel('Mach number'), grid function dstar_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function dstar_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'),... get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

/r/matlab Thread