To create a function with no inputs that plots the given functions using 101 data points over a domain of [0, 10] in MATLAB, you can define the function using the function
keyword and then use the plot
function to generate the plots.
Here is an example code that creates a function called plot_functions
that plots three different functions:
main.m561 chars14 lines
Note that in the plot
function, 'r-'
specifies a red solid line, 'b--'
specifies a blue dashed line, and 'g-'
specifies a green solid line.
You can then call the plot_functions
function to generate the plot:
main.m17 chars2 lines
This will create a figure window displaying the plot of the three functions.
gistlibby LogSnag