Create Function-Based Problems
Write a problem that you want learners to solve using a function. The following
procedure walks you through all the steps necessary to create a problem; if you need
additional help, click or see Example of a Function-Based Problem.
Note
At any time, you can click Choose Different Problem to abandon the draft and return to Add Problem to make a new selection.
Create a title and detailed problem description for the learner. You can include formatted text, equations, links, and images.
Clearly define the number and type of input variables and the number and type of expected outputs. Be specific about the types of values or measurements to be used (for example, degrees in Celsius or metric values).
In Files Referenced, provide data and code files that the reference solution, learner solution, and assessment tests can use.
Set Problem Type to Function.
The Reference Solution is the instructor’s solution. The learner cannot see this solution. You can use a reference solution in your assessment tests to compare your solution to the learner's.
If you want to help learners with some of the solution, fill out the Learner Template. This template contains code that you provide to learners to guide them in creating a solution. You decide how much code to provide to help them get started.
You can lock selected lines in the learner solution so that learners cannot edit these lines. To lock a line, select the lock icon next to the line. Or you can drag down the lock column to lock a range of line. To unlock a locked line, select the lock again.
Learners can run their function before submitting it for assessment. You can help learners test their solutions by providing code that calls the learner function with sample inputs. Enter this code in How to Call the Function. The code then appears in the box labeled Code to call your function, shown in the learner view.
To see the actual formatting of your content, click Learner Preview. The preview area displays the view that the learners see.
Click Save as Draft. Learners cannot see the problem while it is in Draft mode. You can continue developing this problem while it is in draft mode.
Write one or more assessments for the problem. See Write Assessments for Function-Based Learner Solutions.
Validate your solution.
Click Save as Final when the problem is complete. Or, click Save as Draft continue working on the problem before publishing it.
If you want to remove a problem from learner view after publishing it, click Set to Draft.
Example of a Function-Based Problem
In this example, the learner must compute the opposite angles corresponding to two non hypotenuse sides of a right triangle. There are no reference files used in this problem.
Create title and problem description. Use the toolbar to format text.
Set Problem Type to Function.
Fill out the Reference Solution with your solution to the problem.
MATLAB® Grader™ uses the reference solution to fill out the Learner Template. You can remove any code you want the learners to provide, for example, variable values or computations.
To lock lines of code you do not want the learner to change, click the lock icon.
Provide some sample inputs and a call to the function in How to Call the Function.
Click Learner Preview. Note the appearance of the problem and make any adjustments.
Write assessment tests for the problem. See Write Assessments for Function-Based Learner Solutions.
Click Save as Draft at any time to save your work.
When you have finished creating the problem, click Save as Final.