1. DESIGN PROJECT – ME018
PROJECT BY: ALEX LARCHEVEQUE AND MATTHEW CHENG
Functionality:
Our program calculates beam deflections and the angle of rotation of the axis of the beam
for two types of beams: the simply-supported and the cantilever beam. We allow the user to
input important information about the beam in two metric systems, the US customary units
and SI units. These user input values that include 1) the beam’s length, 2) the elastic modulus
of the material, 3) the moment of inertia of the beam’s cross section, 4) the value of load on
the beam, 5) the location of the load. After the user inputs needed information, our program
graphs beam deflection vs. distance and the rotation angle vs. distance. Our program also
finds the max deflection value and the location at where the max deflection occurs. After the
user has retrieved their information, we included a simple “clear” button that allows the user
to easily reset their program.
Development:
We developed this program by writing out our pseudocode first, and then started the back-
end development. After the back-end development was completed (1 function m-file), we
completed the GUI (front-end) portion of our program. In between each development
stage, we constantly ran our program to see if we would output the correct values and
graphs.
Testing Procedures:
Once we completed the back-end code, we tested the values that were posted in the design
handout, and checked them with Professor Sawyer’s graphs to see if our function was
correct. At first, our simply-supported beam code was not correct. We checked our code
over and over again, and found that we forgot to multiply a simple L in one of our formulas.
We fixed it, and got our program to be correct.
We then moved on to the front-end development. During the front-end development, we
would constantly update the GUI, and test our code with the values in the design handout.
We constantly tested our code to catch any bugs that would come up. We would see if our
outputted graphs matched Professor Sawyer’s graphs, and would also see if we retrieved the
same max deflection point values.
8. 8
Calculation and Plotting Function:
% Larcheveque, Alexander
% Cheng, Matt
% Application for Deflection Analysis Beam
% 11/20/2015
function DesignProject (L, E, I, P, a, beamtype)
%Calculates and plots the bean deflections based on the displacement in
the
%y-dorection of point x on the axis of the beam
%PUTWITHGUI : Convert units if not U.S. system
% %Convert m to inches
% if userButton1 == m
% L = (39.3701) .* (L);
% end
%
% %Convert GPa to psi
% if userButton2 == GPa
% E = (145037.73773) .* (E);
% end
%
% %Convert mm.^4 to in.^4
% if userButton3 == mm.^4
% I = (2.40250961.*10.^-6) .* I;
% end
%
% %Convert N to lb
% if userButton4 == N
% P = (0.2248089) .* (P);
% end
%
% %Convert kN to lb
% if userButton4 == kN
% P = (224.80894) .* (P);
% end
%
% %Convert m to inches
% if userButton5 == m
% a = (39.3701) .* (L);
% end
%Check from mistakes that user inserts
if a > L
disp('Your force cannot exceed the beam');
return;
end
%Continue checking for user mistakes (if user did not enter valid beam
%type)
s1 = 'cantilever';
9. 9
s2 = 'simply-supported';
s3 = beamtype;
tf = strcmp(s1,s3);
tf2 = strcmp(s2,s3);
if (tf == 0) && (tf2 == 0)
disp('You did not enter a valid beam type');
return;
end
%Use switch to choose which calculations to use
switch beamtype
case 'simply-supported'
%Calculation for simply supported beam
%Calculate b
b = L - a;
x = linspace(0,L,500);
v = zeros(1, length(x));
%Initialize v_ans & der_v_ans array, also initialize angle, deflection
of
%midpoint, distance from max. deflection, and max deflect
v = zeros(1, length(x));
der_v = zeros(1, length(x));
angle_A = zeros(1, length(x));
angle_B = zeros(1, length(x));
def_midpointC = zeros(1, length(x));
dist_from_max_deflect = zeros(1, length(x));
maxdeflect = zeros(1, length(x));
for ii = 1:length(x)
if (x(ii) <= a) && (x(ii) >= 0)
v(ii) = -((P.*b.*x(ii)) .* (L.^2 - b.^2 - x(ii).^2)) ./
(6.*L.*E.*I);
der_v(ii) = (-((P.*b).*(L.^2 - b.^2 - 3.*(x(ii).^2))) ./
(6.*L.*E.*I));
end
if (x(ii) <= L) && (x(ii) > a)
v(ii) = -(((P.*b.*x(ii)) .* (L.^2-b.^2-x(ii).^2)) ./
(6.*L.*E.*I)) - P.*(x(ii) - a).^3 ./ (6.*E.*I);
der_v(ii) = (-(P.*b).*(L.^2 - b.^2 - 3.*(x(ii).^2)) ./
(6.*L.*E.*I)) - (P.*((x(ii) - a).^2) ./ (2.*E.*I));
10. 10
end
angle_A(ii) = (P.*a.*b).*(L + b) ./ (6.*L.*E.*I);
angle_B(ii) = (P.*a.*b).*(L + a) ./ (6.*L.*E.*I);
if (a >= b)
def_midpointC(ii) = P.*b.*(3.*L.^2 - 4.*b.^2) ./ (48.*E.*I);
dist_from_max_deflect(ii) = sqrt((L.^2 - b.^2) ./ 3);
maxdeflect(ii) = (P.*b.*(L.^2 - b.^2).^(3/2)) ./
(9.*sqrt(3).*L.*E.*I);
else
def_midpointC(ii) = P.*a.*(3.*L.^2 - 4.*a.^2) ./ (48.*E.*I);
end
end
x = linspace(0,L,500);
subplot(2,1,1, 'FontSize', 12);
plot(x,v,'LineWidth', 3);
xlim([0 L]);
title({'Simply-Supported Beam','Deflection vs. Distance'});
ylabel('Y-Direction Deflection (in.)');
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
ymin = v(indexmin);
% strmin = ['Max Deflection = ',num2str(ymin)];
strmin = ['Max deflection =',num2str(ymin), 'in. @ x =
',num2str(xmin)];
text(xmin-1, ymin+0.0005, strmin);
subplot(2,1,2, 'FontSize', 12);
plot(x, der_v, 'LineWidth', 3);
xlim([0 L]);
title('Rotation Angle vs. Distance');
xlabel('Distance From Support');
ylabel('Rotation Angle');
case 'cantilever'
%Calculate b
b = L - a;
11. 11
x = linspace(0,L,500);
v = zeros(1, length(x));
%Initialize v & der_v_ans array
v = zeros(1, length(x));
der_v = zeros(1, length(x));
%Compute calculations for each set of specific values
for ii = 1:length(x)
if (x(ii) <= a) && (x(ii) >= 0)
v(ii) = -((P.*x(ii).^2) .* (3.*a - x(ii))) ./ (6.*E.*I);
der_v(ii) = -((P.*x(ii)).*(2.*a - x(ii))) ./ (2.*E.*I);
end
if (x(ii) <= L) && (x(ii) > a)
v(ii) = -((P.*a.^2) .* (3.*x(ii) - a)) ./ (6.*E.*I);
der_v(ii) = -(P.*a.^2) ./ (2.*E.*I);
end
if x(ii) == a
v(ii) = -(P.*a.^3) ./ (3.*E.*I);
der_v(ii) = -(P .* a.^2) ./ (2.*E.*I);
deflect = ((P.*a.^2).*(3.*L-a)) ./ (6.*E.*I);
anglerot = (P.*a.^2) ./ (2.*E.*I);
end
end
subplot(2,1,1, 'FontSize', 12);
plot(x,v,'LineWidth', 3);
title({'Cantilever Beam','Deflection vs. Distance'});
ylabel('Y-Direction Deflection (in.)');
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
ymin = v(indexmin);
% strmin = ['Max Deflection = ',num2str(ymin)];
strmin = ['Max deflection =',num2str(ymin), 'in. @ x =
',num2str(xmin)];
text(xmin-1, ymin+0.0005, strmin);
subplot(2,1,2, 'FontSize', 12);
plot(x,der_v, 'LineWidth', 3);
title('Rotation Angle vs. Distance');
xlabel('Distance From Support');
13. 13
Main GUI Function:
function varargout = BeamDeflectionAnalysis(varargin)
% BEAMDEFLECTIONANALYSIS MATLAB code for BeamDeflectionAnalysis.fig
% BEAMDEFLECTIONANALYSIS, by itself, creates a new
BEAMDEFLECTIONANALYSIS or raises the existing
% singleton*.
%
% H = BEAMDEFLECTIONANALYSIS returns the handle to a new
BEAMDEFLECTIONANALYSIS or the handle to
% the existing singleton*.
%
% BEAMDEFLECTIONANALYSIS('CALLBACK',hObject,eventData,handles,...)
calls the local
% function named CALLBACK in BEAMDEFLECTIONANALYSIS.M with the
given input arguments.
%
% BEAMDEFLECTIONANALYSIS('Property','Value',...) creates a new
BEAMDEFLECTIONANALYSIS or raises the
% existing singleton*. Starting from the left, property value
pairs are
% applied to the GUI before BeamDeflectionAnalysis_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to
BeamDeflectionAnalysis_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
BeamDeflectionAnalysis
% Last Modified by GUIDE v2.5 23-Nov-2015 10:23:06
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn',
@BeamDeflectionAnalysis_OpeningFcn, ...
'gui_OutputFcn', @BeamDeflectionAnalysis_OutputFcn,
...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
14. 14
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 BeamDeflectionAnalysis is made visible.
function BeamDeflectionAnalysis_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 BeamDeflectionAnalysis (see
VARARGIN)
% Choose default command line output for BeamDeflectionAnalysis
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes BeamDeflectionAnalysis wait for user response (see
UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = BeamDeflectionAnalysis_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 run.
function run_Callback(hObject, eventdata, handles)
% hObject handle to run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
L = str2num(get(handles.l1,'String'));
E = str2num(get(handles.e1,'String'));
I = str2num(get(handles.i1,'String'));
P = str2num(get(handles.p1,'String'));
A = str2num(get(handles.a1,'String'));
15. 15
B = get(handles.beamtype,'SelectedObject');
beamtype = get(B,'String');
%Switch to choose which calculations to use
switch beamtype
case 'Simply-Supported'
%Calculate b
b = L - A;
x = linspace(0,L,500);
v = zeros(1, length(x));
%Initialize v_ans & der_v_ans array, also initialize angle, deflection
of
%midpoint, distance from max. deflection, and max deflect
v = zeros(1, length(x));
der_v = zeros(1, length(x));
angle_A = zeros(1, length(x));
angle_B = zeros(1, length(x));
def_midpointC = zeros(1, length(x));
dist_from_max_deflect = zeros(1, length(x));
maxdeflect = zeros(1, length(x));
for ii = 1:length(x)
if (x(ii) <= A) && (x(ii) >= 0)
v(ii) = -((P.*b.*x(ii)) .* (L.^2 - b.^2 - x(ii).^2)) ./
(6.*L.*E.*I);
der_v(ii) = (-((P.*b).*(L.^2 - b.^2 - 3.*(x(ii).^2))) ./
(6.*L.*E.*I));
end
if (x(ii) <= L) && (x(ii) > A)
v(ii) = -(((P.*b.*x(ii)) .* (L.^2-b.^2-x(ii).^2)) ./
(6.*L.*E.*I)) - P.*(x(ii) - A).^3 ./ (6.*E.*I);
der_v(ii) = (-(P.*b).*(L.^2 - b.^2 - 3.*(x(ii).^2)) ./
(6.*L.*E.*I)) - (P.*((x(ii) - A).^2) ./ (2.*E.*I));
end
angle_A(ii) = (P.*A.*b).*(L + b) ./ (6.*L.*E.*I);
angle_B(ii) = (P.*A.*b).*(L + A) ./ (6.*L.*E.*I);
if (A >= b)
def_midpointC(ii) = P.*b.*(3.*L.^2 - 4.*b.^2) ./ (48.*E.*I);
dist_from_max_deflect(ii) = sqrt((L.^2 - b.^2) ./ 3);
maxdeflect(ii) = (P.*b.*(L.^2 - b.^2).^(3/2)) ./
(9.*sqrt(3).*L.*E.*I);
else
def_midpointC(ii) = P.*A.*(3.*L.^2 - 4.*A.^2) ./ (48.*E.*I);
end
16. 16
end
x = linspace(0,L,500);
axes(handles.axes1);
plot(x,v,'LineWidth', 3);
xlim([0 L]);
ylabel('Y-Direction Deflection (in.)');
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
xx = num2str(xmin);
set(handles.xmax,'String',xx);
ymin = v(indexmin);
yy = num2str(ymin);
set(handles.ymax,'String',yy);
axes(handles.axes2);
plot(x, der_v, 'LineWidth', 3);
xlim([0 L]);
xlabel('Distance From Support');
ylabel('Rotation Angle');
case 'Cantilever'
%Calculate b
b = L - A;
x = linspace(0,L,500);
v = zeros(1, length(x));
%Initialize v & der_v_ans array
v = zeros(1, length(x));
der_v = zeros(1, length(x));
%Compute calculations for each set of specific values
for ii = 1:length(x)
if (x(ii) <= A) && (x(ii) >= 0)
v(ii) = -((P.*x(ii).^2) .* (3.*A - x(ii))) ./ (6.*E.*I);
der_v(ii) = -((P.*x(ii)).*(2.*A - x(ii))) ./ (2.*E.*I);
end
if (x(ii) <= L) && (x(ii) > A)
v(ii) = -((P.*A.^2) .* (3.*x(ii) - A)) ./ (6.*E.*I);
der_v(ii) = -(P.*A.^2) ./ (2.*E.*I);
end
17. 17
if x(ii) == A
v(ii) = -(P.*A.^3) ./ (3.*E.*I);
der_v(ii) = -(P .* A.^2) ./ (2.*E.*I);
deflect = ((P.*A.^2).*(3.*L-A)) ./ (6.*E.*I);
anglerot = (P.*A.^2) ./ (2.*E.*I);
end
end
axes(handles.axes1);
plot(x,v,'LineWidth', 3);
ylabel('Y-Direction Deflection (in.)');
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
xx = num2str(xmin);
set(handles.xmax,'String',xx);
ymin = v(indexmin);
yy = num2str(ymin);
set(handles.ymax,'String',yy);
axes(handles.axes2);
plot(x,der_v, 'LineWidth', 3);
xlabel('Distance From Support');
ylabel('Rotation Angle');
end
% --- Executes on button press in run2.
function run2_Callback(hObject, eventdata, handles)
% hObject handle to run2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
L1 = str2num(get(handles.l2,'String'));
E1 = str2num(get(handles.e2,'String'));
I1 = str2num(get(handles.i2,'String'));
P1 = str2num(get(handles.p2,'String'));
A1 = str2num(get(handles.a2,'String'));
B1 = get(handles.beamtype,'SelectedObject');
beamtype1 = get(B1,'String');
%Switch to choose which calculations to use
switch beamtype1
case 'Simply-Supported'
%Calculate b
b = L1 - A1;
18. 18
x = linspace(0,L1,500);
v = zeros(1, length(x));
%Initialize v_ans & der_v_ans array, also initialize angle, deflection
of
%midpoint, distance from max. deflection, and max deflect
v = zeros(1, length(x));
der_v = zeros(1, length(x));
angle_A = zeros(1, length(x));
angle_B = zeros(1, length(x));
def_midpointC = zeros(1, length(x));
dist_from_max_deflect = zeros(1, length(x));
maxdeflect = zeros(1, length(x));
for ii = 1:length(x)
if (x(ii) <= A1) && (x(ii) >= 0)
v(ii) = -((P1.*b.*x(ii)) .* (L1.^2 - b.^2 - x(ii).^2)) ./
(6.*L1.*E1.*I1);
der_v(ii) = (-((P1.*b).*(L1.^2 - b.^2 - 3.*(x(ii).^2))) ./
(6.*L1.*E1.*I1));
end
if (x(ii) <= L1) && (x(ii) > A1)
v(ii) = -(((P1.*b.*x(ii)) .* (L1.^2-b.^2-x(ii).^2)) ./
(6.*L1.*E1.*I1)) - P1.*(x(ii) - A1).^3 ./ (6.*E1.*I1);
der_v(ii) = (-(P1.*b).*(L1.^2 - b.^2 - 3.*(x(ii).^2)) ./
(6.*L1.*E1.*I1)) - (P1.*((x(ii) - A1).^2) ./ (2.*E1.*I1));
end
angle_A(ii) = (P1.*A1.*b).*(L1 + b) ./ (6.*L1.*E1.*I1);
angle_B(ii) = (P1.*A1.*b).*(L1 + A1) ./ (6.*L1.*E1.*I1);
if (A1 >= b)
def_midpointC(ii) = P1.*b.*(3.*L1.^2 - 4.*b.^2) ./
(48.*E1.*I1);
dist_from_max_deflect(ii) = sqrt((L1.^2 - b.^2) ./ 3);
maxdeflect(ii) = (P1.*b.*(L1.^2 - b.^2).^(3/2)) ./
(9.*sqrt(3).*L1.*E1.*I1);
else
def_midpointC(ii) = P1.*A1.*(3.*L1.^2 - 4.*A1.^2) ./
(48.*E1.*I1);
end
end
x = linspace(0,L1,500);
axes(handles.axes1);
plot(x,v,'LineWidth', 3);
xlim([0 L1]);
ylabel('Y-Direction Deflection (in.)');
19. 19
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
xx = num2str(xmin);
set(handles.xmax,'String',xx);
ymin = v(indexmin);
yy = num2str(ymin);
set(handles.ymax,'String',yy);
axes(handles.axes2);
plot(x, der_v, 'LineWidth', 3);
xlim([0 L1]);
xlabel('Distance From Support');
ylabel('Rotation Angle');
case 'Cantilever'
%Calculate b
b = L1 - A1;
x = linspace(0,L1,500);
v = zeros(1, length(x));
%Initialize v & der_v_ans array
v = zeros(1, length(x));
der_v = zeros(1, length(x));
%Compute calculations for each set of specific values
for ii = 1:length(x)
if (x(ii) <= A1) && (x(ii) >= 0)
v(ii) = -((P1.*x(ii).^2) .* (3.*A1 - x(ii))) ./ (6.*E1.*I1);
der_v(ii) = -((P1.*x(ii)).*(2.*A1 - x(ii))) ./ (2.*E1.*I1);
end
if (x(ii) <= L1) && (x(ii) > A1)
v(ii) = -((P1.*A1.^2) .* (3.*x(ii) - A1)) ./ (6.*E1.*I1);
der_v(ii) = -(P1.*A1.^2) ./ (2.*E1.*I1);
end
if x(ii) == A1
v(ii) = -(P1.*A1.^3) ./ (3.*E1.*I1);
der_v(ii) = -(P1 .* A1.^2) ./ (2.*E1.*I1);
deflect = ((P1.*A1.^2).*(3.*L1-A1)) ./ (6.*E1.*I1);
anglerot = (P1.*A1.^2) ./ (2.*E1.*I1);
end
20. 20
end
axes(handles.axes1);
plot(x,v,'LineWidth', 3);
ylabel('Y-Direction Deflection (in.)');
%Find minimum point
indexmin = find(min(v) == v);
xmin = x(indexmin);
xx = num2str(xmin);
set(handles.xmax,'String',xx);
ymin = v(indexmin);
yy = num2str(ymin);
set(handles.ymax,'String',yy);
axes(handles.axes2);
plot(x,der_v, 'LineWidth', 3);
xlabel('Distance From Support');
ylabel('Rotation Angle');
end
% --- Executes on button press in clear.
function clear_Callback(hObject, eventdata, handles)
% hObject handle to clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.l2, 'String', '');
set(handles.e2, 'String', '');
set(handles.i2, 'String', '');
set(handles.p2, 'String', '');
set(handles.a2, 'String', '');
set(handles.l1, 'String', '');
set(handles.e1, 'String', '');
set(handles.i1, 'String', '');
set(handles.p1, 'String', '');
set(handles.a1, 'String', '');
set(handles.xmax, 'String', '');
set(handles.ymax, 'String', '');
% Clear Axes
axes(handles.axes1);
cla
axes(handles.axes2);
cla
function l2_Callback(hObject, eventdata, handles)
% hObject handle to l2 (see GCBO)
21. 21
% 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 l2 as text
% str2double(get(hObject,'String')) returns contents of l2 as a
double
% --- Executes during object creation, after setting all properties.
function l2_CreateFcn(hObject, eventdata, handles)
% hObject handle to l2 (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
function e2_Callback(hObject, eventdata, handles)
% hObject handle to e2 (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 e2 as text
% str2double(get(hObject,'String')) returns contents of e2 as a
double
% --- Executes during object creation, after setting all properties.
function e2_CreateFcn(hObject, eventdata, handles)
% hObject handle to e2 (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
function i2_Callback(hObject, eventdata, handles)
22. 22
% hObject handle to i2 (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 i2 as text
% str2double(get(hObject,'String')) returns contents of i2 as a
double
% --- Executes during object creation, after setting all properties.
function i2_CreateFcn(hObject, eventdata, handles)
% hObject handle to i2 (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
function p2_Callback(hObject, eventdata, handles)
% hObject handle to p2 (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 p2 as text
% str2double(get(hObject,'String')) returns contents of p2 as a
double
% --- Executes during object creation, after setting all properties.
function p2_CreateFcn(hObject, eventdata, handles)
% hObject handle to p2 (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
23. 23
function a2_Callback(hObject, eventdata, handles)
% hObject handle to a2 (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 a2 as text
% str2double(get(hObject,'String')) returns contents of a2 as a
double
% --- Executes during object creation, after setting all properties.
function a2_CreateFcn(hObject, eventdata, handles)
% hObject handle to a2 (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
function l1_Callback(hObject, eventdata, handles)
% hObject handle to l1 (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 l1 as text
% str2double(get(hObject,'String')) returns contents of l1 as a
double
% --- Executes during object creation, after setting all properties.
function l1_CreateFcn(hObject, eventdata, handles)
% hObject handle to l1 (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
24. 24
function e1_Callback(hObject, eventdata, handles)
% hObject handle to e1 (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 e1 as text
% str2double(get(hObject,'String')) returns contents of e1 as a
double
% --- Executes during object creation, after setting all properties.
function e1_CreateFcn(hObject, eventdata, handles)
% hObject handle to e1 (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
function i1_Callback(hObject, eventdata, handles)
% hObject handle to i1 (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 i1 as text
% str2double(get(hObject,'String')) returns contents of i1 as a
double
% --- Executes during object creation, after setting all properties.
function i1_CreateFcn(hObject, eventdata, handles)
% hObject handle to i1 (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
25. 25
function p1_Callback(hObject, eventdata, handles)
% hObject handle to p1 (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 p1 as text
% str2double(get(hObject,'String')) returns contents of p1 as a
double
% --- Executes during object creation, after setting all properties.
function p1_CreateFcn(hObject, eventdata, handles)
% hObject handle to p1 (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
function a1_Callback(hObject, eventdata, handles)
% hObject handle to a1 (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 a1 as text
% str2double(get(hObject,'String')) returns contents of a1 as a
double
% --- Executes during object creation, after setting all properties.
function a1_CreateFcn(hObject, eventdata, handles)
% hObject handle to a1 (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