Draw Mathematical Equations Using MATLAB
Draw Mathematical Equations Using MATLAB
Presented BY –
Mohamed Abdullah Hassan
Example
x = [0:5:100];
y = x;
plot(x, y)
Example
x = [0 : 0.01: 10];
y = sin(x);
g = cos(x);
plot(x, y, x, g, '.-'), legend('Sin(x)', 'Cos(x)')
Setting Colors on Graph
MATLAB provides eight basic color options for drawing graphs. The following
table shows the colors and their codes −
Code Color
w White
k Black
b Blue
r Red
c Cyan
g Green
m Magenta
y Yellow
Example