function varargout = STP(varargin)
% STP M-file for STP.fig
% STP, by itself, creates a new STP or raises the existing
% singleton*.
%
% H = STP returns the handle to a new STP or the handle to
% the existing singleton*.
%
% STP('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in STP.M with the given input arguments.
%
% STP('Property','Value',...) creates a new STP or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before STP_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to STP_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help STP
% Last Modified by GUIDE v2.5 05-Apr-2013 15:34:10
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @STP_OpeningFcn, ...
'gui_OutputFcn', @STP_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 STP is made visible.
function STP_OpeningFcn(hObject, eventdata, 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 STP (see VARARGIN)
% Choose default command line output for STP
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% This sets up the initial plot - only do when we are invisible
% so window can get raised using STP.
if strcmp(get(hObject,'Visible'),'off')
Pa=7850; %kg/m3
Ta=[20;1200];
Pa1=[0;7850];
plot(Ta,Pa1,'--w','LineWidth',2);
end
% UIWAIT makes STP wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = STP_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)
axes(handles.axes1);
cla;
popup_sel_index = get(handles.popupmenu1, 'Value');
switch popup_sel_index
case 1
Pa=7850; %kg/m3
Ta=[20;1200];
Pa1=[7850;7850];
plot(Ta,Pa1,'--r','LineWidth',2);
xlabel('Temperature (\circC)','FontSize',12)
ylabel('Density (kg/m^3)','FontSize',12)
legend('Density',4)
xlim([0,1200])
ylim([0,15000]);
% creating matrix in gui
dat = [Ta,Pa1,Pa1];
cnames = {'Temperature','Carbon steel','Stainless steel'};
a = uitable('Parent',STP,'Data',dat,'ColumnName',cnames,'Position',[49 85 350 385]);
case 2
%Specific Heat
Ts600=(20:1:600)';[i600 ii600]=size(Ts600);
for ia=1:1:i600;
Ca600(ia,1)=425+7.73*10^-1*Ts600(ia,1)-1.69*10^-3*Ts600(ia,1)^2+2.22*10^-6*Ts600(ia,1)^3;
end
Ts735=(600:1:735)'; [i735 ii735]=size(Ts735);
for ia=1:1:i735;
Ca735(ia,1)=666+(13002/(738-Ts735(ia,1)));
end
Ts900=(735:1:900)'; [i900 ii900]=size(Ts900);
for ia=1:1:i900;
Ca900(ia,1)=545+(17820/(Ts900(ia,1)-731));
end
Ts1200=(900:1:1200)'; [i1200 ii1200]=size(Ts1200);
for ia=1:1:i1200;
Ca1200(ia,1)=650;
end
Tspecific=[Ts600;Ts735;Ts900;Ts1200];
SpHeat=[Ca600;Ca735;Ca900;Ca1200];
%stainless steel
SSS=Tspecific;
[SSSa,SSSb]=size(Tspecific);
for SSSia=1:1:SSSa;
SpHeatS(SSSia,1)=450+0.280*SSS(SSSia,:)-2.91*(10^-4)*SSS(SSSia,:)^2+1.34*(10^-7)*SSS(SSSia,:)^3;
end
%
plot(Tspecific,SpHeat,'--r',Tspecific,SpHeatS,'--b','LineWidth',2);
xlabel('Temperature (\circC)','FontSize',12)
ylabel('Specific Heat (J/kg K)','FontSize',12)
legend('Carbon Steel','Stainless Steel',2)
xlim([0,1200])
ylim([0,5000]);
dat = [Tspecific,SpHeat,SpHeatS];
cnames = {'Temperature','Carbon steel','Stainless steel'};
a = uitable('Parent',STP,'Data',dat,'ColumnName',cnames,'Position',[49 85 350 385]);
case 3
%Thermal Conductivity of Carbon Steel
Tk800=(20:1:800)';[i800 ii800]=size(Tk800);
for ia=1:1:i800;
La800(ia,1)=54-3.33*10^-2*Tk800(ia,1);
end
Tk1200=(800:1:1200)';[i1200 ii1200]=size(Tk1200);
for ia=1:1:i1200;
La1200(ia,1)=27.3;
end
Tconductivity=[Tk800;Tk1200];
Lconductivity=[La800;La1200];
% stainless
SSSC=Tconductivity;
[SSSCa,SSSCb]=size(Tconductivity);
for SSSCia=1:1:SSSCa;
TconductivityS(SSSCia,1)=14.6+1.27*(10^-2)*SSSC(SSSCia,:);
end
plot(Tconductivity,Lconductivity,'--r',Tconductivity,TconductivityS,'--b','LineWidth',2);
xlabel('Temperature (\circC)','FontSize',12)
ylabel('Thermal Conductivity (W/m K)','FontSize',12)
legend('Carbon Steel','Stainless Steel',4)
xlim([0,1200])
ylim([0,60]);
dat = [Tconductivity,Lconductivity,TconductivityS];
cnames = {'Temperature','Carbon steel','Stainless steel'};
a = uitable('Parent',STP,'Data',dat,'ColumnName',cnames,'Position',[49 85 350 385]);
end
% --------------------------------------------------------------------
function FileMenu_Callback(hObject, eventdata, handles)
% hObject handle to FileMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function OpenMenuItem_Callback(hObject, eventdata, handles)
% hObject handle to OpenMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
file = uigetfile('*.fig');
if ~isequal(file, 0)
open(file);
end
% --------------------------------------------------------------------
function PrintMenuItem_Callback(hObject, eventdata, handles)
% hObject handle to PrintMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
printpreview(handles.figure1)
% --------------------------------------------------------------------
function CloseMenuItem_Callback(hObject, eventdata, handles)
% hObject handle to CloseMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = questdlg(['Close ' get(handles.figure1,'Name') '?'],...
['Close ' get(handles.figure1,'Name') '...'],...
'Yes','No','Yes');
if strcmp(selection,'No')
return;
end
delete(handles.figure1)
% --- 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)
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- 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
set(hObject, 'String', {'Density', 'Specific heat', 'Thermal conductivity'});