Drawing Multiple Functions on the Same Graph
You can draw multiple graphs on the same plot. The following example demonstrates the concept:
Example
Create a script file and type the following code:
Define
x
as 100 linearly spaced values between and . Define y1
and y2
as sine and cosine values of x
. Create a line plot of both sets of data.x = linspace(-2*pi,2*pi); y1 = sin(x); y2 = cos(x); figure plot(x,y1,x,y2)
No comments:
Post a Comment