Develop a MATLAB Program with a GUI that computes the deflection of a cantilever
ID: 665458 • Letter: D
Question
Develop a MATLAB Program with a GUI that computes the deflection of a cantilever or simply supported beam. The program should have the following features:
The graphical-user-interface (GUI) should be user friendly, intuitive and well organized. Include pushbuttons to trigger specific actions (“calculate” and “clear” buttons, etc.).
The user input controls in the GUI should include:
Two mutually exclusive radio buttons for the beam’s support configuration (cantilever or simply supported).
Edit boxes for the beam length L, the elastic modulus of the material E, and the moment of inertia of the beam’s cross-section I.
Edit boxes for the value of the load P and the location of the load a. Note that the dimension b = L – a, thus the user should not be required to enter a value for b.
The computed deflection along the entire length of the beam shall be presented with two plots in the GUI; one for the deflection in the y-direction (v) and one for the slope (v ). The maximum deflection and its location should be noted on the plot or somewhere else in the GUI.
The program should be robust in that it includes error-checking and verification of user inputs.
First create a user-defined function to perform the numerical analysis without the GUI. The function should accept the arguments needed to perform the beam deflection analysis and generate the plots. Utilize the top-down approach and pseudo-code in designing the function. At this stage of development, the plots will be generated in a Figure Window. Execute this function from the Command Window to test, debug and revise the function as needed. Be sure your function is well documented with comments in the code. Use the function to evaluate the deflection for test cases listed in Table 1. Verify the function with hand calculations of the maximum deflection and slope for all four test cases.
Once the calculation and plot generation function has been developed and verified, create the GUI. You should be able to call the plot generation function from within the GUI’s “calculate” button callback function with little or no further modification. That is, the callback function for a “calculate” button could simply get and verify the needed values from the GUI, then call the function you created in phase one of the project. This is an example of modular programming.
Explanation / Answer
%function piset = beamdemo() if any(get(0,'children') == 3), close(3), end echo on clc % The (known) equation for a cantilever beam with a contentrated % force is given by % d = k * (P*l^3)/(E*I) % where d is the tip deflection, k a dimensionless factor, P the % tip force, l the beam length, E the Young's modulus and I the % moment of inertia pause % strike any key to continue % The relevance list is now given by: % Variable Names N = {'d','k','P','l','E' ,'I'}; % Variable units u = {'m','1','N','m','N/m2','m4'}; % Note: The unit of the dimensionless factor k is "1" pause % strike any key to continue RL = rlist(N,unit2si(u)); pause % strike any key to continue % Let''s take a look at the relevance list entry for d RL(1) RL(1).Dimension' pause % strike any key to continue % Now it's time to choose the base variables bv = {'E','l'}; pause % strike any key to continue % And perform the dimensional analysis piset = diman(RL,bv); pause % strike any key to continue % Ok, that''s the dimensional set now: piset.A piset.B piset.C piset.D {piset.Name{piset.order}} pause % strike any key to continue % and the dimensionless numbers are pretty(piset);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.