% echodemo m01
%%
% Matlab - Zakladni operace
4+6+2
%%
4*25 + 6*22
%%
a = 4
%%
b = 6
%%
c = a + b
%%
who
%%
whos
%%
clear a
%%
clear
%%
pi, eps, inf, NaN, i, j, realmin, realmax
%%
x = sqrt(2)/2
%%
y = asin(x)
%%
y_deg = y*180/pi
%%
c1 = 1-2i
%%
c1 = 1-2j
%%
c2 = 3*(2-sqrt(-1)*3)
%%
c3 = sqrt(-2)
%%
c6 = (c1+c2)/c3  % from the above data
%%
check = i^2 
%%
check = real(check)
%%
help sqrt
%%
help
%%
help sin
%%
lookfor complex
%%
[1 -2i 3 4 5+6i], [1-2i 3 4 5+6i], [(1 -2i) 3 4 5+6i], 
%%
x = [4 1 sqrt(2) sin(0.5) 23.2]
%%
x = [0 0.1*pi 0.2*pi 0.3*pi 0.4*pi 0.5*pi 0.6*pi 0.7*pi 0.8*pi 0.9*pi pi]
%%
y = sin(x)
%%
x, x(3)
%%
x, y(5)
%%
1:5
%%
x(1:5)
%%
3:-1:1, y, y(3:-1:1)
%%
2:2:7, x, x(2:2:7)
%%
y, y([8 2 9 1])
%%
0:0.1:1, x = (0:0.1:1)*pi
%%
x = linspace(0, pi, 11)
%%
logspace(0, 2, 11)
%%
a = 1:5, b = 1:2:9
%%
c = [b a]
%%
d = [a(1:2:5) 1 0 1]
%%
a-2
%%
2*a-1
%%
a+b
%%
ans-b
%%
2*a-b
%%
a*b
%%
a.*b
%%
a./b
%%
b.\a
%%
a/b
%%
a\b
%%
a.^2
%%
2.^a
%%
b.^a
%%
b.^(a-3) 
%%
c = [1;2;3;4;5]
%%
a = 1:5
%%
b = a'
%%
c = b'
%%
c = a.'
%%
d = a + i*a
%%
e = d'
%%
f = d.'
%%
g = [1 2 3 4; 5 6 7 8]
%%
%g = [1 2 3 4
%5 6 7 8
%9 10 11 12]
%%
h = [1 2 3; 4 5 6 7]
%%
x = linspace(0, 2*pi, 30);
%%
y = sin(x);
%%
plot(x, y)
%%
z = cos(x);
%%
plot(x,y, x,z)
%%
plot(x,y, x,y,'+')
%%
plot(y,z)
%%
plot(x,y, x,2*y.*z,'--')
%%
grid
xlabel('nezavisle promenna x')
ylabel('zavisle promenna')
title('2sin(x)cos(x) = sin(2x)')
%%
plot3(y,z,x), grid
