9 Examples of GUIDE UIs
If you run the two_axes program and click the Plot button, the UI appears as shown
in the preceding figure. The code evaluates the expression displayed at the top of the UI
using parameters that you enter in the f1, f2, and t fields. The upper line graph displays
a Fourier transform of the computed signal displayed in the lower line graph.
UI Design
This UI plots two graphs depicting three input values:
- Frequency one (f1)
- Frequency two (f2)
- A time vector (t)
When you click the Plot button, the program puts these values into a MATLAB
expression that is the sum of two sine functions:
x = sin(2*pi*f1*t) + sin(2*pi*f2*t)
Then, the program calculates the FFT (fast Fourier transform) of x and plots the data in
the frequency domain and the time domain in separate axes.
Default Values for Inputs
The program provides default values for the three inputs. This enables you to click the
Plot button and see a result as soon as you run the program. The defaults indicate
typical values.
The default values are created by setting the String property of the edit text. The
following figure shows how the value was set for the time vector.