Contents
A1
f1 = @(x) -2*(x+3).^2+5;
f2 = @(x) (3*x.^3-1)./(x.^2+3);
f3 = @(x) (x+2).^sin(2*pi*x);
f4 = @(x) x.*exp(-x);
g1 = @(v,w) v'*w;
g2 = @(v) sqrt(g1(v,v));
g3 = @(v,w) acos(g1(v,w)/(g2(v)*g2(w)))/(2*pi)*360;
x = linspace(0,1,100);
plot(f3(x))
A2
x = [0.1 4.3 5.6 10.9 13.5 16.7 21.9];
v = (x(1:end-1)+x(2:end))/2
w = sort([x,v])
v =
2.2000 4.9500 8.2500 12.2000 15.1000 19.3000
w =
Columns 1 through 7
0.1000 2.2000 4.3000 4.9500 5.6000 8.2500 10.9000
Columns 8 through 13
12.2000 13.5000 15.1000 16.7000 19.3000 21.9000
A3
p = [1 1 1 1 1 ];
(length(p)-1:-1:0)
q = (length(p)-1:-1:0) .* p
ans =
4 3 2 1 0
q =
4 3 2 1 0
A4
A = rand(8)
MAX_SP = max(A)
MIN_Z = min(A')
MAX_A = max(max(A))
[zeile,spalte]= find(A>0.75);
[zeile,spalte]
A =
Columns 1 through 7
0.6022 0.3225 0.3411 0.1887 0.6476 0.6073 0.8419
0.3868 0.7847 0.6074 0.2875 0.6790 0.4501 0.8329
0.9160 0.4714 0.1917 0.0911 0.6358 0.4587 0.2564
0.0012 0.0358 0.7384 0.5762 0.9452 0.6619 0.6135
0.4624 0.1759 0.2428 0.6834 0.2089 0.7703 0.5822
0.4243 0.7218 0.9174 0.5466 0.7093 0.3502 0.5407
0.4609 0.4735 0.2691 0.4257 0.2362 0.6620 0.8699
0.7702 0.1527 0.7655 0.6444 0.1194 0.4162 0.2648
Column 8
0.3181
0.1192
0.9398
0.6456
0.4795
0.6393
0.5447
0.6473
MAX_SP =
Columns 1 through 7
0.9160 0.7847 0.9174 0.6834 0.9452 0.7703 0.8699
Column 8
0.9398
MIN_Z =
Columns 1 through 7
0.1887 0.1192 0.0911 0.0012 0.1759 0.3502 0.2362
Column 8
0.1194
MAX_A =
0.9452
ans =
3 1
8 1
2 2
6 3
8 3
4 5
5 6
1 7
2 7
7 7
3 8