>> a = [1, 2, 3, 4, 5, 6] a = 1 2 3 4 5 6
>> b = 2*a - 1 b = 1 3 5 7 9 11
>> c = log(b) c = 0 1.0986 1.6094 1.9459 2.1972 2.3979
>> a.^3 ans = 1 8 27 64 125 216
sum | Summe aller Werte |
max | größter Wert |
min | kleinster Wert |
length | Anzahl der Elemente |
mean | Mittelwert |
std | Standard-Abweichung |
sort | sortierter Vektor |
>> a' ans = 1 2 3 4 5 6
>> b*a' ans = 161
>> a(3) ans = 3
>> a(3:5) ans = 3 4 5
>> a(4:end) ans = 4 5 6
>> a(1:2:6) ans = 1 3 5
>> 1:0.4:3 ans = 1.0000 1.4000 1.8000 2.2000 2.6000 3.0000
t = 0:0.1:4*pi; y = sin(t); plot(t,y)
y2 = 0.5*log(t); y3 = exp(-0.1*t.*t); plot(t, y, t, y2, t, y3)
plot(t, y, t, y2, t, y3, [0, 4*pi], [0, 0]);
plot(t, y, "bo", t, y2, "g.", t, y3, "r-.", [0, 4*pi], [0, 0], "k-") title("Meine Lieblingsfunktionen", ... "FontSize", 14, "FontWeight", "bold") xlabel("Zeit"); ylabel("Auslenkung"); xlim([0, 4*pi]) legend("Sinus", "Logarithmus", "Glocke", "Location", "best");