To plot two different functions in MATLAB, you can use the plot() function multiple times with different input arguments for the X and Y values of each function. Here's an example code that plots two functions sin(x) and cos(x) in the range of -pi to pi:
main.m420 chars11 lines
This code will create a graph that looks like this:

The first plot() call plots the sin(x) function with a solid red line, while the second plot() call plots the cos(x) function with a dashed blue line. The legend() function adds a legend to the graph so that you can differentiate between the two functions, and the xlabel(), ylabel(), and title() functions add labels and a title to the graph to make it easy to understand.
gistlibby LogSnag