CE update
BIN
ws2012/CE/Folien/RepTeil1.pdf
Normal file
BIN
ws2012/CE/Folien/RepTeil2_3.3.8-3.5.pdf
Normal file
BIN
ws2012/CE/Folien/RepTeil3_3.6-5.pdf
Normal file
BIN
ws2012/CE/Folien/gms-11-NAE-col.pdf
Normal file
BIN
ws2012/CE/Folien/gms-12-NAE-col.pdf
Normal file
BIN
ws2012/CE/Klausuren/Alte CE Klausur 2008.pdf
Normal file
BIN
ws2012/CE/Klausuren/Probeklausur WS11-12/probeklausur.pdf
Normal file
BIN
ws2012/CE/Klausuren/Probeklausur WS12-13/probeklausur.pdf
Normal file
BIN
ws2012/CE/Klausuren/Probeklausur WS12-13/probeklausur_lsg.pdf
Normal file
22
ws2012/CE/Klausurzettel.rtf
Normal file
@ -0,0 +1,22 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\f0\fs24 \cf0 \
|
||||
- Berechnen einer L\'f6sung einer DGL (allgemeine und spezielle L\'f6sung)\
|
||||
- Formeln f\'fcr Zeitcharakteristika (-> Steifheitsma\'df)\
|
||||
- Formeln f\'fcr alle m\'f6glichen Approximationsverfahren (Euler-, Runge-Kutta und co.)\
|
||||
-> explizites / implizites Euler-Verfahren mit mehrdimensionalem System\
|
||||
(vgl. \'dcbung 7 Aufgabe 2 d)\
|
||||
- PD-Regelung linearer System (\'fcberkritisch ged\'e4mpft, kritisch ged\'e4mpft, unterkritisch ged\'e4mpft)\
|
||||
(vgl. \'dcbung 12 Aufgabe 2)\
|
||||
- R\'e4uber-Beute-Modell -> Probeklausur Aufgabe 3\
|
||||
- PQ-Formel / ABC-Formel\
|
||||
- Schritte einer Simulationsstudie\
|
||||
- Regeln f\'fcr die automatische Modellgenerierung\
|
||||
- unklare MC-Fragen\
|
||||
- Fragen aus Probeklausur zur Modellierung und Simulation\
|
||||
- Formel zu Pseudozufallszahlengenerator\
|
||||
- Formel zu Mittelwert und Varianz}
|
||||
55
ws2012/CE/offene Fragen.rtf
Normal file
@ -0,0 +1,55 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww11560\viewh11700\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\f0\b\fs24 \cf0 \'dcbungen 4 Aufgabe 1b):
|
||||
\b0 \
|
||||
- Warum ist die erste Ruhelage stabil obwohl der Realteil von Eigenwert lambda_3/4 = 0 ist ?\
|
||||
Es hei\'dft doch hier, dass bei Re(EW) = 0 keine Aussage \'fcber Stabilit\'e4t getroffen werden kann\'85\
|
||||
=> 3,0151i = 3 + 151i laut Wolframalpha.\
|
||||
\
|
||||
|
||||
\b Was ist eine Referenztrajektorie?
|
||||
\b0 \
|
||||
=> Eine Referenztrajektorie gibt einen Ruhebereich in Abh\'e4ngigkeit von der Zeit t an. (z.B. eine stabile/instabile Umlaufbahn um einen Planeten). Daher ist das Einsetzen von expliziten t_s nicht notwendig (-> durch das Einsetzen von t_s erh\'e4lt man eine Ruhelage, falls die Referenztrajektorie stabil ist.) Deshalb setzt man immer die allgemeinen Referenztrajektorie ein!! Vgl. \'dcbung 4 Aufgabe 2 a)\
|
||||
\
|
||||
\
|
||||
\
|
||||
|
||||
\b Probleklausur WS10/11:
|
||||
\b0 \
|
||||
letzte Aufgabe: Mechanik\
|
||||
\
|
||||
|
||||
\b Probleklausur WS11/12:
|
||||
\b0 \
|
||||
Aufgabe 4c): Eigenwert f\'fcr d=0 m\'fcsste doch 0 sein und somit keine Aussage \'fcber Stabilit\'e4t m\'f6glich?\
|
||||
Aufgabe 5d): Warum kann hier nur t_2 schalten. Laut Definition kann eine Transition schalten, wenn ihre Eing\'e4nge belegt sind.\
|
||||
Aufgabe 6 c): Komische Umformung in autonomes System.\
|
||||
-> Schaltfunktion bestimmen.\
|
||||
-> Richtungsfelder zeichnen\
|
||||
\
|
||||
\
|
||||
|
||||
\b \'dcbung 5 Aufgabe 2a)
|
||||
\b0 Addition von Gleitkommazahlen letzte Schritt "Anpassen an die Mantisse"\
|
||||
\
|
||||
|
||||
\b \'dcbung 6 Aufgabe 2a):
|
||||
\b0 hier wird von der "einfachen Form" des Newton-Verfahren gesprochen. Was ist die komplizierte Form? Die Form mit der Matrixschreibweise? \
|
||||
\
|
||||
|
||||
\b \'dcbung 8 Aufgabe 1c):
|
||||
\b0 Heun-Verfahren zeichnerisch L\'f6sen\
|
||||
\
|
||||
|
||||
\b \'dcbung 12 Aufgabe 2:
|
||||
\b0 Verschiedene Schwingungstypen. Wie kommt man von den Eigenwerten auf den Schwingungstyp? PD-Regelung ?!\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
}
|
||||
1
ws2012/CE/sharedFolder/.dropbox
Normal file
@ -0,0 +1 @@
|
||||
232391711
|
||||
BIN
ws2012/CE/sharedFolder/DGL_Verfahren.pdf
Normal file
0
ws2012/CE/sharedFolder/Icon
Normal file
BIN
ws2012/CE/sharedFolder/Klausuren/Alte CE Klausur 2008.pdf
Normal file
BIN
ws2012/CE/sharedFolder/MC-Fragen.pdf
Normal file
BIN
ws2012/CE/sharedFolder/Zusammenfassungen/CEZusammenfassung.pdf
Normal file
BIN
ws2012/CE/uebungen/0/EiCE_Loesungsvorschlag00.pdf
Normal file
BIN
ws2012/CE/uebungen/1/EiCE_Loesungsvorschlag01.pdf
Normal file
BIN
ws2012/CE/uebungen/10/EiCE_Loesungsvorschlag10.pdf
Normal file
BIN
ws2012/CE/uebungen/10/EiCE_Uebung10.pdf
Normal file
BIN
ws2012/CE/uebungen/10/andere Gruppe/1.odt
Executable file
BIN
ws2012/CE/uebungen/10/andere Gruppe/1b.odg
Executable file
BIN
ws2012/CE/uebungen/10/andere Gruppe/2.odt
Executable file
BIN
ws2012/CE/uebungen/11/EiCE_Loesungsvorschlag11.pdf
Normal file
BIN
ws2012/CE/uebungen/11/EiCE_Uebung11.pdf
Normal file
BIN
ws2012/CE/uebungen/11/andere Gruppe/1.jpg
Executable file
|
After Width: | Height: | Size: 645 KiB |
BIN
ws2012/CE/uebungen/11/andere Gruppe/1_simon.odt
Executable file
BIN
ws2012/CE/uebungen/11/andere Gruppe/2_simon.odt
Executable file
BIN
ws2012/CE/uebungen/12/EiCE_Loesungsvorschlag12.pdf
Normal file
BIN
ws2012/CE/uebungen/12/EiCE_Uebung12.pdf
Normal file
BIN
ws2012/CE/uebungen/12/andere gruppe/1_simon.odt
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/1_simon.pdf
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/2_simon.odt
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/2_simon.pdf
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/Linearisierung.pdf
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/Lösung-Jan.pdf
Executable file
BIN
ws2012/CE/uebungen/12/andere gruppe/Modellanalyse.pdf
Executable file
BIN
ws2012/CE/uebungen/12/eigeneLoesung.pdf
Normal file
BIN
ws2012/CE/uebungen/2/EiCE_Loesungsvorschlag02.pdf
Normal file
BIN
ws2012/CE/uebungen/3/EiCE_Loesungsvorschlag03.pdf
Normal file
BIN
ws2012/CE/uebungen/4/EiCE_Loesungsvorschlag04.pdf
Normal file
BIN
ws2012/CE/uebungen/4/Loesung/a1_1.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
ws2012/CE/uebungen/4/Loesung/a1_2.jpg
Normal file
|
After Width: | Height: | Size: 2.4 MiB |
BIN
ws2012/CE/uebungen/4/Loesung/a2_1.jpg
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
ws2012/CE/uebungen/4/Loesung/a2_2.jpg
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
BIN
ws2012/CE/uebungen/5/EiCE_Loesungsvorschlag05_1.pdf
Normal file
BIN
ws2012/CE/uebungen/6/EiCE_Loesungsvorschlag06.pdf
Normal file
BIN
ws2012/CE/uebungen/8/EiCE_Loesungsvorschlag08.pdf
Normal file
BIN
ws2012/CE/uebungen/8/Einschrittverfahren_dgl-2-11.pdf
Normal file
BIN
ws2012/CE/uebungen/8/andere Gruppe/CE - Uebung8.zip
Normal file
BIN
ws2012/CE/uebungen/8/andere Gruppe/Seite1.JPG
Executable file
|
After Width: | Height: | Size: 138 KiB |
BIN
ws2012/CE/uebungen/8/andere Gruppe/Seite2.JPG
Executable file
|
After Width: | Height: | Size: 137 KiB |
BIN
ws2012/CE/uebungen/8/andere Gruppe/Seite3.JPG
Executable file
|
After Width: | Height: | Size: 132 KiB |
BIN
ws2012/CE/uebungen/8/andere Gruppe/Seite4.JPG
Executable file
|
After Width: | Height: | Size: 137 KiB |
BIN
ws2012/CE/uebungen/9/EICE_Loesungsvorschlag09.pdf
Normal file
BIN
ws2012/CE/uebungen/9/EiCE_Uebung09.pdf
Normal file
BIN
ws2012/CE/uebungen/9/andere gruppe/1a.odt
Executable file
BIN
ws2012/CE/uebungen/9/andere gruppe/1b.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
2
ws2012/CE/uebungen/9/andere gruppe/1c.txt
Executable file
@ -0,0 +1,2 @@
|
||||
q1 = x-22
|
||||
q2 = x-18
|
||||
BIN
ws2012/CE/uebungen/9/andere gruppe/1d.odt
Executable file
BIN
ws2012/CE/uebungen/9/andere gruppe/1e.odt
Executable file
BIN
ws2012/CE/uebungen/9/andere gruppe/2a.odt
Executable file
BIN
ws2012/CE/uebungen/9/andere gruppe/2b.odt
Executable file
1
ws2012/CE/uebungen/P3/.dropbox
Normal file
@ -0,0 +1 @@
|
||||
207435091
|
||||
0
ws2012/CE/uebungen/P3/Icon
Normal file
0
ws2012/CE/uebungen/P3/Icon
Normal file
BIN
ws2012/CE/uebungen/P3/P3Matlab/Grafik.pdf
Normal file
36
ws2012/CE/uebungen/P3/P3Matlab/fixpoint.m
Normal file
@ -0,0 +1,36 @@
|
||||
function [N,x] = fixpoint (x0)
|
||||
% Function fixpoint
|
||||
% In: Start value
|
||||
% Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xCur = x0;
|
||||
xOld = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
yTemp = (A - x(3)*eye(2))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2-1;
|
||||
y = [ yTemp ; lambda];
|
||||
end
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
end
|
||||
|
||||
function [y] = fixpoint_next(x)
|
||||
y = x - inv(jacobi(x0)) * f(x);
|
||||
end
|
||||
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(norm(xCur-xOld) > epsilon && N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
end
|
||||
63
ws2012/CE/uebungen/P3/P3Matlab/main.m
Normal file
@ -0,0 +1,63 @@
|
||||
function main();
|
||||
|
||||
% Main function for iteration of static values in
|
||||
% eigenvalue problem
|
||||
%
|
||||
%
|
||||
% Grundlagen der Modellierung und Simulation
|
||||
% WiSe 2012/13
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%% Start Values %%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x = [-3; 0; 0]
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x_fixpunkt = x;
|
||||
x_newton = x;
|
||||
x_qnewton = x;
|
||||
|
||||
%%%%%%%%%%%%%%%%%%% Fixpunkt %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_f, x_f] = fixpoint(x_fixpunkt);
|
||||
|
||||
%%%%%%%%%%%%%%%%%%% Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_n, x_n] = newton(x_newton);
|
||||
|
||||
%%%%%%%%%%%%%%%%%%% Quasi-Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_qn, x_qn] = quasi_newton(x_qnewton);
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%% Output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
disp('Startwert x');
|
||||
x
|
||||
|
||||
disp('Anzahl Iterationen bei Fixpunkt:');
|
||||
it_f
|
||||
disp('Loesung:');
|
||||
x_f(:,it_f)
|
||||
%x_f
|
||||
|
||||
disp('Anzahl Iterationen bei Newton:');
|
||||
it_n
|
||||
disp('Loesung:');
|
||||
x_n(:,it_n)
|
||||
%x_n
|
||||
disp('Anzahl Iterationen bei Quasi-Newton:');
|
||||
it_qn
|
||||
disp('Loesung:');
|
||||
x_qn(:,it_qn)
|
||||
|
||||
|
||||
semilogy(1:it_n, abs(x_n(3,:)-2), ...
|
||||
1:it_f, abs(x_f(3,:)-2), ...
|
||||
1:it_qn, abs(x_qn(3,:)-2))
|
||||
title('Iterationsverfahren');
|
||||
legend('error (Newton) ','error (FixP)','error (Quasi-Newton)')
|
||||
xlabel('Anzahl Iterationen');
|
||||
ylabel('Fehler in lambda');
|
||||
|
||||
10
ws2012/CE/uebungen/P3/P3Matlab/myeigen.m
Normal file
@ -0,0 +1,10 @@
|
||||
function [out] = fmyeigen(x)
|
||||
% Defines a function which has eigenvector/eigenvalue as roots
|
||||
% x(1) : first component of eigenvector
|
||||
% x(2) : second component of eigenvector
|
||||
% x(3) : eigenvalue
|
||||
|
||||
out=[(3-x(3))*x(1)+4*x(2); x(1)+(6-x(3))*x(2); x(1)*x(1)+x(2)*x(2)-1];
|
||||
|
||||
end
|
||||
|
||||
36
ws2012/CE/uebungen/P3/P3Matlab/newton.m
Normal file
@ -0,0 +1,36 @@
|
||||
function [N, x] = newton(x0)
|
||||
% Function newton
|
||||
% In: Start value
|
||||
% Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xOld = x0;
|
||||
xCur = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
yTemp = (A - x(3)*eye(2))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2-1;
|
||||
y = [ yTemp ; lambda];
|
||||
end
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
end
|
||||
|
||||
function [y] = newton_next(x)
|
||||
y = x - jacobi(x)\f(x);
|
||||
end
|
||||
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(norm(xCur-xOld) > epsilon && N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
end
|
||||
48
ws2012/CE/uebungen/P3/P3Matlab/quasi_newton.m
Normal file
@ -0,0 +1,48 @@
|
||||
function [N,x] = quasi_newton(x0)
|
||||
% Function quasi_newton
|
||||
% In: Start value
|
||||
% Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xCur = x0;
|
||||
xOld = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
yTemp = (A - x(3)*eye(2))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2 - 1;
|
||||
y = [ yTemp ; lambda];
|
||||
end
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
end
|
||||
|
||||
function [y] = newton_next(x)
|
||||
y = x + getDeltaX(x);
|
||||
end
|
||||
|
||||
function [y] = getDeltaX(x)
|
||||
y = jac\(-f(x));
|
||||
end
|
||||
|
||||
jac = jacobi(x0);
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(abs(norm(xCur)-norm(xOld)) > epsilon && N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
% anpassen der angenäherten jacobi matrix
|
||||
% ---------------------------------------
|
||||
% Schritt 1 - delta X ausrechnen
|
||||
delta = getDeltaX(xOld);
|
||||
% Schritt 2 - x^k ausrechnen
|
||||
xCur = newton_next(xOld);
|
||||
% Schritt 3 & 4 - f(x^k) = f(xCur) und anpassen der Jacobi Matrix
|
||||
jac = jac + (1/norm(delta)^2)*(f(xCur) - f(xOld) - jac*delta) * delta';
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
end
|
||||
71
ws2012/CE/uebungen/P3/P3Matlab/results.txt
Normal file
@ -0,0 +1,71 @@
|
||||
Gruppe:
|
||||
- Michael Scholz (Matr.# 1576630)
|
||||
- David Kaufmann (Matr.# 1481864)
|
||||
- Dennis Werner (Matr.# 1513509)
|
||||
|
||||
|
||||
Ausgabe der main-Funktion in Matlab:
|
||||
|
||||
|
||||
1. Aufruf von main liefert:
|
||||
==============================
|
||||
|
||||
>> main
|
||||
|
||||
x =
|
||||
|
||||
-3
|
||||
0
|
||||
0
|
||||
|
||||
Startwert x
|
||||
|
||||
x =
|
||||
|
||||
-3
|
||||
0
|
||||
0
|
||||
|
||||
Anzahl Iterationen bei Fixpunkt:
|
||||
|
||||
it_f =
|
||||
|
||||
47
|
||||
|
||||
Loesung:
|
||||
|
||||
ans =
|
||||
|
||||
-0.9701
|
||||
0.2425
|
||||
2.0000
|
||||
|
||||
Anzahl Iterationen bei Newton:
|
||||
|
||||
it_n =
|
||||
|
||||
6
|
||||
|
||||
Loesung:
|
||||
|
||||
ans =
|
||||
|
||||
-0.9701
|
||||
0.2425
|
||||
2.0000
|
||||
|
||||
Anzahl Iterationen bei Quasi-Newton:
|
||||
|
||||
it_qn =
|
||||
|
||||
14
|
||||
|
||||
Loesung:
|
||||
|
||||
ans =
|
||||
|
||||
-0.9701
|
||||
0.2425
|
||||
2.0000
|
||||
|
||||
>>
|
||||
37
ws2012/CE/uebungen/P3/P3Scilab/Dave/fixpoint.sc
Normal file
@ -0,0 +1,37 @@
|
||||
function [N,x] = fixpoint (x0)
|
||||
// Function fixpoint
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xCur = x0;
|
||||
xOld = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
// eye(A) muss in matlab durch eye(2) ersetzt werden
|
||||
yTemp = (A - x(3)*eye(A))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2-1;
|
||||
y = [ yTemp ; lambda];
|
||||
endfunction
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
endfunction
|
||||
|
||||
function [y] = fixpoint_next(x)
|
||||
y = x - inv(jacobi(x0)) * f(x);
|
||||
endfunction
|
||||
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(abs(norm(xCur)-norm(xOld)) > epsilon & N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
endfunction
|
||||
65
ws2012/CE/uebungen/P3/P3Scilab/Dave/main.sc
Executable file
@ -0,0 +1,65 @@
|
||||
function main();
|
||||
|
||||
// Main function for iteration of static values in
|
||||
// eigenvalue problem
|
||||
//
|
||||
//
|
||||
// Grundlagen der Modellierung und Simulation
|
||||
// WiSe 2012/13
|
||||
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%% Start Values %%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x = [-3; 0; 0]
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x_fixpunkt = x;
|
||||
x_newton = x;
|
||||
x_qnewton = x;
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Fixpunkt %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_f, x_f] = fixpoint(x_fixpunkt);
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_n, x_n] = newton(x_newton);
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Quasi-Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_qn, x_qn] = quasi_newton(x_qnewton);
|
||||
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
disp('Startwert x');
|
||||
x
|
||||
|
||||
disp('Anzahl Iterationen bei Fixpunkt:');
|
||||
it_f
|
||||
disp('Loesung:');
|
||||
x_f(:,it_f)
|
||||
%x_f
|
||||
|
||||
disp('Anzahl Iterationen bei Newton:');
|
||||
it_n
|
||||
disp('Loesung:');
|
||||
x_n(:,it_n)
|
||||
%x_n
|
||||
disp('Anzahl Iterationen bei Quasi-Newton:');
|
||||
it_qn
|
||||
disp('Loesung:');
|
||||
x_qn(:,it_qn)
|
||||
|
||||
|
||||
semilogy(1:it_n, abs(x_n(3,:)-2), ...
|
||||
1:it_f, abs(x_f(3,:)-2), ...
|
||||
1:it_qn, abs(x_qn(3,:)-2))
|
||||
title('Iterationsverfahren');
|
||||
legend('error (Newton) ','error (FixP)','error (Quasi-Newton)')
|
||||
xlabel('Anzahl Iterationen');
|
||||
ylabel('Fehler in lambda');
|
||||
|
||||
endfunction
|
||||
|
||||
10
ws2012/CE/uebungen/P3/P3Scilab/Dave/myeigen.sc
Executable file
@ -0,0 +1,10 @@
|
||||
function [out] = fmyeigen(x)
|
||||
// Defines a function which has eigenvector/eigenvalue as roots
|
||||
// x(1) : first component of eigenvector
|
||||
// x(2) : second component of eigenvector
|
||||
// x(3) : eigenvalue
|
||||
|
||||
out=[(3-x(3))*x(1)+4*x(2); x(1)+(6-x(3))*x(2); x(1)*x(1)+x(2)*x(2)-1];
|
||||
|
||||
endfunction
|
||||
|
||||
37
ws2012/CE/uebungen/P3/P3Scilab/Dave/newton.sc
Normal file
@ -0,0 +1,37 @@
|
||||
function [N, x] = newton(x0)
|
||||
// Function newton
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xOld = x0;
|
||||
xCur = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
// eye(A) muss in matlab durch eye(2) ersetzt werden
|
||||
yTemp = (A - x(3)*eye(A))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2-1;
|
||||
y = [ yTemp ; lambda];
|
||||
endfunction
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
endfunction
|
||||
|
||||
function [y] = newton_next(x)
|
||||
y = x - jacobi(x)\f(x);
|
||||
endfunction
|
||||
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(abs(norm(xCur)-norm(xOld)) > epsilon & N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
endfunction
|
||||
46
ws2012/CE/uebungen/P3/P3Scilab/Dave/quasi_newton.sc
Normal file
@ -0,0 +1,46 @@
|
||||
function [N, x] = quasi_newton(x0);
|
||||
// Function quasi_newton
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xCur = x0;
|
||||
xOld = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
// eye(A) muss in matlab durch eye(2) ersetzt werden
|
||||
yTemp = (A - x(3)*eye(A))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2 - 1;
|
||||
y = [ yTemp ; lambda];
|
||||
endfunction
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
endfunction
|
||||
|
||||
function [y] = newton_next(x)
|
||||
y = x + getDeltaX(x);
|
||||
endfunction
|
||||
|
||||
function [y] = getDeltaX(x)
|
||||
y = jac\(-f(x));
|
||||
endfunction
|
||||
|
||||
jac = jacobi(x0);
|
||||
xCur = newton_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(abs(norm(xCur)-norm(xOld)) > epsilon & N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
// anpassen der angenäherten jacobi matrix
|
||||
delta = getDeltaX(xOld); //schritt 1
|
||||
xCur = newton_next(xOld); //schritt 2
|
||||
//delta'*delta in matlab evtll durch norm(delta,2) austauschen
|
||||
jac = jac + (1/(delta'*delta))*(f(xCur) - f(xOld) - jac*delta) * delta'; //schritt 4
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
endfunction
|
||||
59
ws2012/CE/uebungen/P3/P3Scilab/Dave/results.txt
Normal file
@ -0,0 +1,59 @@
|
||||
-->[N, X] = newton([-3;0;0])
|
||||
X =
|
||||
|
||||
- 1.6666667 - 1.1121653 - 0.9790265 - 0.9701824 - 0.9701425 - 0.9701425
|
||||
0.2777778 0.265897 0.2443321 0.2425437 0.2425356 0.2425356
|
||||
1.2962963 1.7950236 1.976989 1.9998 2. 2.
|
||||
N =
|
||||
|
||||
6.
|
||||
|
||||
|
||||
-->[N, X] = fixpoint([-3;0;0])
|
||||
X =
|
||||
|
||||
|
||||
column 1 to 7
|
||||
|
||||
- 1.6666667 - 1.3575103 - 1.2033799 - 1.1161244 - 1.0636206 - 1.0308881 - 1.0100171
|
||||
0.2777778 0.2862654 0.2746085 0.2632281 0.2551597 0.2499909 0.2468379
|
||||
1.2962963 1.5519547 1.6869252 1.7754082 1.8382905 1.8841094 1.917574
|
||||
|
||||
column 8 to 14
|
||||
|
||||
- 0.9965065 - 0.9876671 - 0.9818386 - 0.9779729 - 0.9753975 - 0.9736757 - 0.9725214
|
||||
0.2449727 0.2438948 0.2432839 0.2429434 0.2427563 0.2426548 0.2426001
|
||||
1.941856 1.9593059 1.9717187 1.980464 1.986573 1.9908095 1.9937297
|
||||
|
||||
column 15 to 21
|
||||
|
||||
- 0.9717459 - 0.9712241 - 0.9708726 - 0.9706355 - 0.9704755 - 0.9703675 - 0.9702945
|
||||
0.2425708 0.2425551 0.2425466 0.2425420 0.2425394 0.2425379 0.2425371
|
||||
1.995733 1.9971018 1.9980344 1.9986683 1.9990984 1.99939 1.9995874
|
||||
|
||||
column 22 to 28
|
||||
|
||||
- 0.9702453 - 0.9702119 - 0.9701894 - 0.9701742 - 0.9701639 - 0.970157 - 0.9701523
|
||||
0.2425366 0.2425362 0.2425360 0.2425359 0.2425358 0.2425357 0.2425357
|
||||
1.999721 1.9998114 1.9998725 1.9999138 1.9999417 1.9999606 1.9999734
|
||||
|
||||
column 29 to 35
|
||||
|
||||
- 0.9701491 - 0.9701470 - 0.9701455 - 0.9701445 - 0.9701439 - 0.9701434 - 0.9701431
|
||||
0.2425357 0.2425357 0.2425357 0.2425356 0.2425356 0.2425356 0.2425356
|
||||
1.999982 1.9999878 1.9999918 1.9999944 1.9999962 1.9999975 1.9999983
|
||||
|
||||
column 36 to 42
|
||||
|
||||
- 0.9701429 - 0.9701428 - 0.9701427 - 0.9701426 - 0.9701426 - 0.9701426 - 0.9701425
|
||||
0.2425356 0.2425356 0.2425356 0.2425356 0.2425356 0.2425356 0.2425356
|
||||
1.9999988 1.9999992 1.9999995 1.9999996 1.9999998 1.9999998 1.9999999
|
||||
|
||||
column 43 to 46
|
||||
|
||||
- 0.9701425 - 0.9701425 - 0.9701425 - 0.9701425
|
||||
0.2425356 0.2425356 0.2425356 0.2425356
|
||||
1.9999999 1.9999999 2. 2.
|
||||
N =
|
||||
|
||||
46.
|
||||
37
ws2012/CE/uebungen/P3/P3Scilab/fixpoint.sc
Executable file
@ -0,0 +1,37 @@
|
||||
function [N,x] = fixpoint (x0)
|
||||
// Function fixpoint
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
N=1;
|
||||
xCur = x0;
|
||||
xOld = x0;
|
||||
epsilon = 10^(-8);
|
||||
A = [3,4;1,6];
|
||||
|
||||
function [y] = f(x)
|
||||
// eye(A) muss in matlab durch eye(2) ersetzt werden
|
||||
yTemp = (A - x(3)*eye(A))*[x(1);x(2)];
|
||||
lambda = x(1)^2+x(2)^2-1;
|
||||
y = [ yTemp ; lambda];
|
||||
endfunction
|
||||
|
||||
function [y] = jacobi(x)
|
||||
y1 = [A(1,1)-x(3) , A(1,2) , -x(1)];
|
||||
y2 = [A(2,1) , A(2,2)-x(3) , -x(2)];
|
||||
y3 = [2*x(1) , 2*x(2) , 0];
|
||||
y = [y1;y2;y3];
|
||||
endfunction
|
||||
|
||||
function [y] = fixpoint_next(x)
|
||||
y = x - inv(jacobi(x0)) * f(x);
|
||||
endfunction
|
||||
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
while(norm(xCur-xOld) > epsilon & N < 60)
|
||||
N = N + 1;
|
||||
xOld = xCur;
|
||||
xCur = fixpoint_next(xOld);
|
||||
x(:,N) = xCur;
|
||||
end
|
||||
endfunction
|
||||
65
ws2012/CE/uebungen/P3/P3Scilab/main.sc
Executable file
@ -0,0 +1,65 @@
|
||||
function main();
|
||||
|
||||
// Main function for iteration of static values in
|
||||
// eigenvalue problem
|
||||
//
|
||||
//
|
||||
// Grundlagen der Modellierung und Simulation
|
||||
// WiSe 2012/13
|
||||
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%% Start Values %%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x = [-3; 0; 0]
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
x_fixpunkt = x;
|
||||
x_newton = x;
|
||||
x_qnewton = x;
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Fixpunkt %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_f, x_f] = fixpoint(x_fixpunkt);
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_n, x_n] = newton(x_newton);
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Quasi-Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
[it_qn, x_qn] = quasi_newton(x_qnewton);
|
||||
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%% Output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
disp('Startwert x');
|
||||
x
|
||||
|
||||
disp('Anzahl Iterationen bei Fixpunkt:');
|
||||
it_f
|
||||
disp('Loesung:');
|
||||
x_f(:,it_f)
|
||||
%x_f
|
||||
|
||||
disp('Anzahl Iterationen bei Newton:');
|
||||
it_n
|
||||
disp('Loesung:');
|
||||
x_n(:,it_n)
|
||||
%x_n
|
||||
disp('Anzahl Iterationen bei Quasi-Newton:');
|
||||
it_qn
|
||||
disp('Loesung:');
|
||||
x_qn(:,it_qn)
|
||||
|
||||
|
||||
semilogy(1:it_n, abs(x_n(3,:)-2), ...
|
||||
1:it_f, abs(x_f(3,:)-2), ...
|
||||
1:it_qn, abs(x_qn(3,:)-2))
|
||||
title('Iterationsverfahren');
|
||||
legend('error (Newton) ','error (FixP)','error (Quasi-Newton)')
|
||||
xlabel('Anzahl Iterationen');
|
||||
ylabel('Fehler in lambda');
|
||||
|
||||
endfunction
|
||||
|
||||
10
ws2012/CE/uebungen/P3/P3Scilab/myeigen.sc
Executable file
@ -0,0 +1,10 @@
|
||||
function [out] = fmyeigen(x)
|
||||
// Defines a function which has eigenvector/eigenvalue as roots
|
||||
// x(1) : first component of eigenvector
|
||||
// x(2) : second component of eigenvector
|
||||
// x(3) : eigenvalue
|
||||
|
||||
out=[(3-x(3))*x(1)+4*x(2); x(1)+(6-x(3))*x(2); x(1)*x(1)+x(2)*x(2)-1];
|
||||
|
||||
endfunction
|
||||
|
||||
46
ws2012/CE/uebungen/P3/P3Scilab/newton.sc
Executable file
@ -0,0 +1,46 @@
|
||||
function [N, matrixX] = newton(x0)
|
||||
|
||||
// Function newton
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
|
||||
// Todo: Replace below code with Newton method
|
||||
|
||||
|
||||
bool=1;
|
||||
N=1;
|
||||
x=x0;
|
||||
xTmp = x0;
|
||||
e = 10^(-8);
|
||||
matrixX = []; //matrix we use for iterations
|
||||
matrixA = [3 4;1 6];
|
||||
|
||||
//define function f(x) as vectorfunction:
|
||||
function [y] = f(x)
|
||||
y = [(matrixA(1,1)-x(3))*x(1) + matrixA(1,2)*x(2) ;
|
||||
matrixA(2,1)*x(1) + (matrixA(2,2)-x(3))*x(2) ;
|
||||
(x(1)^2-1) + (x(2)^2 -1)];
|
||||
endfunction
|
||||
|
||||
|
||||
while(bool == 1)
|
||||
//calculate x (of current iteration)
|
||||
jac = numdiff(f, x); //jacobi-matrix
|
||||
deltaX = jac\(-f(x));
|
||||
x = x + deltaX;
|
||||
|
||||
//add x to output matrix
|
||||
matrixX(:,N) = x;
|
||||
|
||||
//check criteria
|
||||
if(N == 60 | (abs(norm(xTmp)-norm(x)) < e & N >1))
|
||||
bool = 0; //-> will cancel the while-loop
|
||||
end
|
||||
|
||||
N = N+1; //increase N
|
||||
xTmp = x;
|
||||
|
||||
end
|
||||
|
||||
N = N-1;
|
||||
endfunction
|
||||
56
ws2012/CE/uebungen/P3/P3Scilab/quasi_newton.sc
Executable file
@ -0,0 +1,56 @@
|
||||
function [N, matrixX] = quasi_newton(x0);
|
||||
|
||||
// Function quasi_newton
|
||||
// In: Start value
|
||||
// Out: number of iteration steps, vector of solution
|
||||
|
||||
// Todo: Replace below code with quasi-Newton method
|
||||
|
||||
|
||||
bool=1;
|
||||
N=1;
|
||||
x=x0;
|
||||
xTmp = x0;
|
||||
e = 10^(-8);
|
||||
matrixX = []; //matrix we use for iterations
|
||||
matrixA = [3 4;1 6];
|
||||
a = 1;
|
||||
|
||||
|
||||
//define function f(x) as vectorfunction:
|
||||
function [y] = f(x)
|
||||
y = [(matrixA(1,1)-x(3))*x(1) + matrixA(1,2)*x(2) ;
|
||||
matrixA(2,1)*x(1) + (matrixA(2,2)-x(3))*x(2) ;
|
||||
(x(1)^2) + (x(2)^2) - 1];
|
||||
endfunction
|
||||
|
||||
|
||||
jac = numdiff(f, x); //jacobi-matrix
|
||||
|
||||
|
||||
while(bool == 1)
|
||||
//calculate x (of current iteration)
|
||||
|
||||
deltaX = jac\(-f(x));
|
||||
x = x + deltaX;
|
||||
|
||||
//add x to output matrix
|
||||
matrixX(:,N) = x;
|
||||
|
||||
//calculate jacobi-matrix for next iteration
|
||||
deltaF = f(x) - f(x-deltaX);
|
||||
incr = 1 / (norm(deltaX)^2)*(deltaF-jac*a*deltaX)*(a.*deltaX)';
|
||||
jac = jac + incr;
|
||||
|
||||
//check criteria
|
||||
if(N == 30 | (abs(norm(xTmp)-norm(x)) < e & N >1))
|
||||
bool = 0; //-> will cancel the while-loop
|
||||
end
|
||||
|
||||
N = N+1; //increase N
|
||||
xTmp = x;
|
||||
|
||||
end
|
||||
|
||||
N = N-1;
|
||||
endfunction
|
||||
BIN
ws2012/CE/uebungen/P3/loesung_7.pdf
Normal file
1
ws2012/CE/uebungen/P4/.dropbox
Normal file
@ -0,0 +1 @@
|
||||
219911329
|
||||