1+1
1+2*3^4
(1+2*3)^4
5/6
6\5
exp(-3)
sin(pi/6)
atan2d(1,-1)
ans
1.6e-19
a=20
a+2
pi
e
2+i
j
e^(i*pi)+1
eps
N=2
size(N)
a=[1,2,3]
size(a)
b=[1;2;3]
size(b)
C=[1,2,3;4,5,6;7,8,9]
octave> A=[
 1 2 3
 4 5 6
 7 8 10
]
[C,C,C; C,C,C]
C(2,1)
C(1:3,2)
C(:,2)
C(:,end)
C(:,[1,3])
1:3
0:.1:1
%  [,;,] concatenates  (,) indexes   :: ranges   ' tranposes
C*b
a*C
C*a
C*a'
C+C
C*C
C^2
inv(C)
inv(C)*b
C\b
C*ans
C.^2
[0:4]/4
asind(sqrt([0:4]/4))
acosd(sqrt([0:4]/4))
a
sum(a)
max(a)
min(a)
@(x)x^2
f=@(x)x^2
f(3)
f([1:5])
x=(0:.01:5)';
size(x)
plot(x,f(x))
plot(x,[f(x);10*sin(x)])
xlabel('x')
title('function')
help <interp1
Xi=2:.2:3
Yi=interp1(X,Y,Xi)>
Yc=interp1(X,Y,Xi,'cubic')
hold on
plot(Xi,[Yi;Yc],'*')
fsolve(@(x)f(x)-2,1)
plot(ans,2,'o')
sqrt(2)

% small example of integrating by hand
x=0; y=1; dx=.1; yf=2;
while (y(end)<yf)
  x(end+1)=x(end)+dx;
  y(end+1)=y(end)+dx*y(end);
end %now interpolate the value at yf
((y(end)-yf)*x(end-1) + (yf-y(end-1))*x(end))/(y(end)-y(end-1))
log(2) %compare to the exact solution
plot(x,y)

% same thing using matlab functionality
sol=ode45(@(x,y)y,[0:.1:2],1)
interp1(sol.y,sol.x,yf)
plot(sol.x,sol.y)
