1 / 7

Einführung in die numerische Programmierumgebung Matlab

Übung zur Numerische Geologie. Einführung in die numerische Programmierumgebung Matlab . 1. Erstellung einer Zahlenreihe (Array). a = [1 2 3]. a = [1,2,3]. a = [1;2;3]. a = [1;2;3];. 2. Erstellung äquidistanter Arrays. a1 = [1:10] Intervall wir automatisch auf 1 gesetzt.

selena
Download Presentation

Einführung in die numerische Programmierumgebung Matlab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 1. Erstellung einer Zahlenreihe (Array) a = [1 2 3] a = [1,2,3] a = [1;2;3] a = [1;2;3]; 2. Erstellung äquidistanter Arrays a1 = [1:10] Intervall wir automatisch auf 1 gesetzt a2 = [1:2:10] Intervall wir über mittleren Zahlenwert definiert a3 = a1(4) Herauslösen einer einzelnen Zahl aus einem Array 3. Abfrage der Länge eines Arrays length(a2) Length_a2 = length(a2) Längenabfrage dient zur Definition einer neuen Variablen Klemens Seelos 13-17.05.2005

  2. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 4. Abfrage des Workspace (spezieller Arbeitsspeicher) von Matlab who whos zeigt zusätzliche Informationen zu den Arrays usw… 5. Abfrage des aktuellen Verzeichnisses dir 6. Definition einer Matrize b = [1 2 3; 4 5 6; 7 8 9] b1 = zeros(3,7) bildet eine 3-7-Matrize bestehend nur aus Nullen b2 = ones(2,4,6) bildet eine dreidimenionale 2-4-6-Matrize bestehend nur aus Einsen b3 = [ ] leeres Array / Matrize 7. Größenabfrage einer bestehenden Matrize size_b2 =size(b2) Klemens Seelos 13-17.05.2005

  3. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 8. Verknüpfung von Matrizen b4 = vertcat(b1,b2) vertikale Verknüpfung b5 = horzcat(b1,b2) horizontale Verknüpfung 9. Drehen einer Matrize c = b‘ 10. Matrizen-/ Arrayoperationen d = b*3 e = d+10 addiert zu jeder Komp. den def. Wert – wichtig ist der Punkt hinter dem zu addierenden Wert f = sum(a) summiert alle Komponenten der Matrize h = mean (a) arithmetisches Mittel i = std (a) Standardabweichung j = min (a) kleinster Wert des Arrays k = max (a) größter Wert des Arrays Klemens Seelos 13-17.05.2005

  4. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 11. Grafikoperationen plot(a)einfacher Linienplot figure; plot(a, ‘.‘)Punktplot in eigenem Fenster (figure-Befehl) figure; plot(a, ‘r.‘)roter Punktplot in eigenem Fenster (figure-Befehl) figure; bar(a)vertikaler Balkenplot figure; barh(a)horizontaler Balkenplot figure; subplot(2,1,1);Zweigeteiltes Plotfenster bar (a) subplot(2,1,2); plot (a) Klemens Seelos 13-17.05.2005

  5. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 12. Schleifen – if-Operationen if a(2) == 2 x = 'ja' else x = 'nein' end 13. Schleifen – if-Operationen if a(2) == 2 & a(3) == 2 x='jein' elseif a(2) == 2 & a(3) == 3 x='ja' else x='nein' end Klemens Seelos 13-17.05.2005

  6. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 14. Schleifen – for-Operationen for y = 1:5 a(y) = 2 end 15. Schleifen – for-Operationen y = 1:10; for z = sum(y) a(y) = 10/z end 16. Schleifen – zusätzliche Einbettung in eine for-Schleife for y = 1:10 for z = sum(y) a(y) = 10/z end end Klemens Seelos 13-17.05.2005

  7. Übung zur Numerische Geologie Einführung in die numerische Programmierumgebung Matlab 17. Schleifen – while-Operationen a=zeros(1,10) z=1; while z<=10 a(z)= z; z=z+1; end Übungen !!! Klemens Seelos 13-17.05.2005

More Related