Learn how to build a simple GUI in Matlab, using GUIDE if it helps (and it will). Do this for the cgview() function. Most of the material on this page is repeated/clarified in the README file.
cgview.m provides visualization of the convergence (or nonconvergence) of the conjugate gradient (CG) algorithm for solving linear systems A*x = b. You don't have to know anything about the CG method to create the GUI. But you'll find it helpful to look through the files in the order they are invoked.
In several places user input is needed, via the "input()" command. Replace some of those with GUI windows. Have the GUI initially display the default values, so that a user can just click some OK button or similar GUI widget. The defaults are in isempty() blocks right after each input() is requested.
Almost no error checking is done, which is a big weakness that you do not need to address. But life will be easier if (when testing your GUI with non-default parameters) you make sure that n, maxits, tol are positive values and pausetime is nonnegative. matrixtype has only two possible options and both of them are strings. The goal here is not to bulletproof the code, just to practice with setting up a GUI. To make the write-execute-debug cycle faster, try the values
15 <lt; n < 200
4 < maxits < 1.2*n
0 <= pausetime < 0.5
If you want to play around with it after setting up the GUI, have fun (e.g., fun might include trying n = 2000, maxits = 2*n, pausetime = 0). Just be aware that it will take a few seconds to run the numerical algorithm for large values of n.
Steps to take: in general you create a design and layout for the GUI elements choosing whatever widgets are suitable for the values and actions needed. Matlab has a "layout editor" for this. It will create two files: a .m and .fig file. You program the actions that will be taken by writing "callbacks" using the m-file editor. GUIDE will create "stubs" for this in the m-file it generates, and they will have explicit comments saying something like 'insert here what actions the gui needs to take on a button press'.
For this assignment, the minimal expected is items 1 - 3 listed below, and using the easier alternative for the parameter variable 'power' in step 2. If you want more practice, you can do step 4 onwards, or any subset of those that you want to try.
n (a positive integer)
maxits (a positive integer)
tol (a positive floating point number)
pausetime (a positive floating point number)
matrixtype (one of two strings)
matrixtype is one of the strings 'clump' or 'curve'.
The code does no error-checking on the last item, so having the
GUI provide only those two options will solve that problem. These
inputs are roughly in lines 20-75 of drivecgview.m. Default
values are in the code itself:
n = 100
maxits = 1.5*n
tol = 1.0e-8
pausetime = 0.1
matrixtype = 'curve'
The user will need some way of indicating when all of the
parameters in the GUI are OK, so that the cgview() code can start.
This will require a single callback being implemented by you.
Alternatively, if you find it easier have that GUI element be part of the frame from step 1. Filling in a value for power when 'clump' is specified won't have any effect and won't hurt anything. But if you use this alternative it'd be a bit more user-friendly if the choice of power was greyed-out (that is, non-settable) when 'clump' is specified.