In [21]:
### add 2 + 3
2 + 3
In [23]:
### divide
3 / 4
In [26]:
### natural log
log(10)
log10(10)
In [30]:
### what about trig?
cos(pi)
sin(pi/2)
PAUSE: Find the sine of 45 degrees
In [50]:
a = [1 2 3 4];
In [51]:
a
In [52]:
a + 2
In [54]:
B = [1 2 3 4; 6 8 10 12]
In [55]:
C = B / 2
In [56]:
a * B
In [57]:
a .* B
In [58]:
D = a .* B
In [62]:
D(1, 4)
In [43]:
x = [0:0.1:4*pi];
y = [sin(x); cos(x)];
plot(x, y);
xlabel ("x");
ylabel ("y");
legend("sin(x)", "cos(x)")