• Home
  • Textbooks
  • MATLAB Programming for Engineers
  • Graphical User Interfaces

MATLAB Programming for Engineers

Stephen J.Chapman

Chapter 10

Graphical User Interfaces - all with Video Answers

Educators


Chapter Questions

02:10

Problem 1

Explain the steps required to create a GUI in MATLAB.

SS
Sarvesh Somasundaram
Numerade Educator
08:07

Problem 2

How does a callback function work? How can a callback function locate the figures and objects that it needs to manipulate?

Willis James
Willis James
Numerade Educator
02:10

Problem 3

Create a GUI that uses a popup menu to select the background color displayed by the GUI.

SS
Sarvesh Somasundaram
Numerade Educator
02:10

Problem 4

Create a GUI that uses a standard menu to select the background color displayed by the GUI.

SS
Sarvesh Somasundaram
Numerade Educator
05:38

Problem 5

Write a GUl program that plots the equation $y(x)=a x^{2}+b x+c$. The program should have a set of axes for the plot and should have GUI elements to input the values of $a, b, c$, and the minimum and maximum $x$ to plot. Include tool tips for each of your GUI elements.

Rakvi .
Rakvi .
Numerade Educator
01:50

Problem 6

Modify the GUI of Exercise $10.5$ to include a menu. The menu should include two submenus to select the color and line style of the plotted line, with a check mark beside the currently selected menu choices. The menu should also include an "Exit" option. If the user selects this option, the program should create a modal question dialog box asking "Are You Sure?", with the appropriate responses.

Rebecca Wang
Rebecca Wang
Numerade Educator
02:07

Problem 7

Modify the List Box example in Section 10.4.8 to allow for multiple selections in the list box. The text field should display a list of all selections whenever the "Select" button is clicked.

Akash M
Akash M
Numerade Educator
02:40

Problem 8

Random Number Distributions. Create a GUI to display the distributions of different types of random numbers. The program should create the distributions by generating an array of 200,000 random values from a distribution and using function hist to create a histogram. Be sure to label the title and axes of the histogram properly.
The program should support uniform, Gaussian, and Rayleigh distributions, with the distribution selection made by a popup menu. In addition, it should have an edit box to allow the user to select the number of bins in the histogram. Make sure that the values entered in the edit box are legal (the number of bins must be a positive integer).

Ryan Mcalister
Ryan Mcalister
Numerade Educator
04:55

Problem 9

Modify the temperature conversion GUI of Example $10.1$ to add a "thermometer." The thermometer should be a set of rectangular axes with a red "fluid" level corresponding to the current temperature in degrees Celsius. The range of the thermometer should be $0^{\circ}-100^{\circ} \mathrm{C}$.

Carson Merrill
Carson Merrill
Numerade Educator
01:21

Problem 10

Modify the temperature conversion GUI of Exercise $10.9$ to allow you to adjust the displayed temperature by clicking the mouse. (Warning: This exercise requires material not discussed in this chapter. Refer to the CurrentPoint property of figure objects in the on-line MATLAB documentation.)

Shazia Naz
Shazia Naz
Numerade Educator
01:09

Problem 11

Least Squares Fit. Create a GUI that can read an input data set from a file and perform a least-squares fit to the data. The data will be stored in a disk file in $(x, y)$ format, with one $x$ and one $y$ value per line. Perform the least-squares fit with the MATLAB function polyfit, and plot both the original data and the least-squares fitted line. Include two menus: File and Edit. The File menu should include File/Open and File/Exit menu items, and the user should receive an "Are You Sure?" prompt before exiting. The Edit menu item should allow the user to customize the display, including line style, line color, and grid status.

Fuzail Shakir
Fuzail Shakir
Numerade Educator
01:20

Problem 12

Modify the GUI of the previous exercise to include an EditPreferences menu item that allows the user to suppress the "Are You Sure?" exit prompt.

Adam Conner
Adam Conner
Numerade Educator
03:06

Problem 13

Modify the GUI of the previous exercise to read and write an initialization file. The file should contain the line style, line color, grid choice (on/off), and exit prompt choice made by the user on previous runs. These choices should be automatically written out and saved when the program exits via the File/Exit menu item, and they should be read in and used whenever the program is started again.

Foster Wisusik
Foster Wisusik
Numerade Educator