You are on page 1of 5

function ins_SelectionChangeFcn(hObject, eventdata, handles)

if hObject==handles.wood
k1=0.12;
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif hObject==handles.glass
k1=0.055
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif hObject==handles.lr
k1=2.3;
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif hObject==handles.la
k1=1.5;
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif hObject==handles.am
k1=0.04;
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif hObject==handles.ac
k1=(47+58)/2;
h=10;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
end

function cl_Callback(hObject, eventdata, handles)


% hObject handle to cl (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 cl as text


% str2double(get(hObject,'String')) returns contents of cl as a
double

% --- Executes during object creation, after setting all properties.


function cl_CreateFcn(hObject, eventdata, handles)
% hObject handle to cl (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 when selected object is changed in pl.


function pl_SelectionChangeFcn(hObject, eventdata, handles)
if hObject==handles.aires
h=0.024;
elseif hObject==handles.watter
h=0.58;
elseif hObject==handles.steams
h=0.0401;
elseif hObject==handles.steamc
h=0.0251;
end
h;

% --- Executes on button press in rpta.


function rpta_Callback(hObject, eventdata, handles)
%% OBTENCION DE DATOS
k1=1;
h=1;
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
errorr=10101010;%debido a que existen 24 posibilidades solo analiza los
mas importantes
%% SOLUCION NUMERICA
if wf>ta | ta>wf
if wf>wl & wf>wr
q1=k1*((wf-((wr+wl)/2))/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
elseif wl>wf & wr>wf
q1=k1*((((wr+wl)/2)-wf)/0.2);
q2=h*(((wl+wf+wr)/3)-ta);
q=(q1+q2)/2;
set(handles.cl,'String',q);
else
set(handles.cl,'String',errorr);
end
else
set(handles.cl,'String',errorr);
end
%% GRFICO
n = 100; %grid has n - 2 interior points per dimension (overlapping)
x = linspace(0,1,n); dx = x(2)-x(1); y = x; dy = dx;
TOL = 1e-6;
T = zeros(n);
T(1,1:n) = wf; %frontal
T(n,1:n) = ta; %back
T(1:n,1) = wl; %LEFT
T(1:n,n) = wr; %RIGHT
dt = dx^2/4;
error = 1; k = 0;
while error > TOL
k = k+1;
Told = T;
for i = 2:n-1
for j = 2:n-1
T(i,j) = dt*((Told(i+1,j)-2*Told(i,j)+Told(i-1,j))/dx^2 ...
+ (Told(i,j+1)-2*Told(i,j)+Told(i,j-1))/dy^2) ...
+ Told(i,j);
end
end
error = max(max(abs(Told-T)));
end
axes(handles.dib)
pcolor(x,y,T),shading interp,
title('Temperature (Steady State)'),colorbar

% --- Executes on button press in see.


function see_Callback(hObject, eventdata, handles)
wf=str2double(get(handles.wf,'String'));
ta=str2double(get(handles.ta,'String'));
wl=str2double(get(handles.wl,'String'));
wr=str2double(get(handles.wr,'String'));
n = 20; %grid has n - 2 interior points per dimension (overlapping)
x = linspace(0,1,n); dx = x(2)-x(1); y = x; dy = dx;
TOL = 1e-6;
T = zeros(n);
T(1,1:n) = wf; %frontal
T(n,1:n) = ta; %back
T(1:n,1) = wl; %LEFT
T(1:n,n) = wr; %RIGHT
dt = dx^2/4;
error = 1; k = 0;
while error > TOL
k = k+1;
Told = T;
for i = 2:n-1
for j = 2:n-1
T(i,j) = dt*((Told(i+1,j)-2*Told(i,j)+Told(i-1,j))/dx^2 ...
+ (Told(i,j+1)-2*Told(i,j)+Told(i,j-1))/dy^2) ...
+ Told(i,j);
end
end
error = max(max(abs(Told-T)));
end
axes(handles.dib)
surf(y,x,T)
title('Temperature (Steady State)'),colorbar

% --- Executes when selected object is changed in uipanel1.


function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
if hObject==handles.mad
n=str2double(get(handles.cl,'String'));
rr=0.159*n;
set(handles.cl,'String',rr);
elseif hObject==handles.vid
n=str2double(get(handles.cl,'String'));
rr=0.7*n;
set(handles.cl,'String',rr);
elseif hObject==handles.lr
n=str2double(get(handles.cl,'String'));
rr=2.3*n;
set(handles.cl,'String',rr);
elseif hObject==handles.la
n=str2double(get(handles.cl,'String'));
rr=0.72*n;
set(handles.cl,'String',rr);
elseif hObject==handles.am
n=str2double(get(handles.cl,'String'));
rr=0.04*n;
set(handles.cl,'String',rr);
elseif hObject==handles.ac
n=str2double(get(handles.cl,'String'));
rr=52.5*n;
set(handles.cl,'String',rr);
end
% --- Executes when selected object is changed in locus.
function locus_SelectionChangeFcn(hObject, eventdata, handles)
ta=str2double(get(handles.ta,'String'));
if hObject==handles.wa
n=str2double(get(handles.cl,'String'));
wah=(-(ta^2))*(10^-6)+(0.0017*ta)+0.5628;
rr=wah*n;
set(handles.cl,'String',rr);
elseif hObject==handles.stc
n=str2double(get(handles.cl,'String'));
steam=(9*10^-11)*(ta^4)-(5*10^-8)*(ta^3)+(1*10^-5)*(ta^2)-
(0.0005*ta)+0.0171;
rr=steam*n;
set(handles.cl,'String',rr);
elseif hObject==handles.st
n=str2double(get(handles.cl,'String'));
steamo=(9.6*10^-11)*(ta^4)-(5.4*10^-8)*(ta^3)+(1.6*10^-5)*(ta^2)-
(0.0006*ta)+0.0204;
rr=steamo*n;
set(handles.cl,'String',rr);
elseif hObject==handles.noo
n=str2double(get(handles.cl,'String'));
sti=(0.00002*ta)+0.0135;
rr=sti*n;
set(handles.cl,'String',rr);
end

You might also like