Sie sind auf Seite 1von 1

1 % Matlab initialisieren:

2 close all; clear all; clc; format compact; format short g;


3
4
5 %Gleichungssysteme
6
7 % Parameter:
8 A [0.6,0.2,0;0.3, 0.4,0.7;0.1,0.4,0.3]
9 B=[62; 92;46]
10 %Berechnungen und Ausgabe:
11 G=[A,B]
12 H=rref (G)
13 C=cond (A)
14
15
16 Plots
17
18% Parameter:
19 x_0=0; x_E=4; N=201; lw=3; fig=1;
20% Funktionen:
21 f @(x)2.^x;
22 g=@(x)2*sin(x+2);
23 h @(x)x.^2;
24 x_data=linspace (x_0,x_E, N) %Angaben für x
25 f_data=f(x_data); g_data=g(x_data); h_data=h(x_data); 26 % Plot:
27 fh figure(fig); plot(x_data, f_data, 1, lw);
28 hold on; plot(x_data,g_data, 1, lw);
29 hold on; plot(x_data, h_data, 1, lw); hold off;
30 xlabel("x"); ylabel("y"); Achsenbeschriftung
31 legend("f", "g", "h"); grid( 'on'); axis ("image"); %Plotbeschriftung
32
33
34 %Vektoren
35
36% Parameter:
37 v=[1;2;3]; w= [4;5;6];
38 %Skalarprodukt
39 v=dot(v, w)
40 %Vektorprodukt
41 z=cross ([1;2;3], w)
42 %Länge/Betrag eines Vektors
43 l=norm(v)
44
45
46 %Matrizen
47
48 %Matrizen:
49 A=[1,2,3,4,5,6,7,8,9]
50 B-[4,5,6,7,8,9;1,2,3] 51 %Addition/Subtraktion: 52 M1=A+B 53 M2=A-B

Das könnte Ihnen auch gefallen