Folien CE, FoC

This commit is contained in:
M.Scholz 2011-12-06 09:45:37 +01:00
parent 7346b8825f
commit e6058ffe15
21 changed files with 134 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,11 @@
function [N,X_itn] = fixpoint (x)
% Function fixpoint with relaxation matrix
% In: Start value
% Out: number of iteration steps, vector of solution
% Todo: Replace below code with fixpoint method
N=1;
X_itn=x;

View File

@ -0,0 +1,90 @@
function main();
% Main function for iteration of static values in
% pendulum with newton and fixed point method.
%
%
% Grundlagen der Modellierung und Simulation
% SoSe 2011
%%%%%%%%%%%%%%%%%%%%%% Start Values %%%%%%%%%%%%%%%%%%%%
x = [10; 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x_newton = x;
x_fixpunkt = x;
x_qnewton = x;
%%%%%%%%%%%%%%%%%%% Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[it_n, x_n] = newton(x_newton);
%%%%%%%%%%%%%%%%%%% Fixpunkt %%%%%%%%%%%%%%%%%%%%%%%%%%%
[it_f, x_f] = fixpoint(x_fixpunkt);
%%%%%%%%%%%%%%%%%%% Quasi-Newton %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[it_qn, x_qn] = quasi_newton(x_qnewton);
%%%%%%%%%%%%%%%%%%% Output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Startwert x');
[x(1), x(2)]
disp('Anzahl Iterationen bei Newton:');
it_n
disp('Loesung:');
x_n(1,it_n)
disp('Anzahl Iterationen bei Fixpunkt:');
it_f
disp('Loesung:');
x_f(1,it_f)
disp('Anzahl Iterationen bei Quasi-Newton:');
it_qn
disp('Loesung:');
x_qn(1,it_qn)
it_ges = max(it_n,max( it_f,it_qn));
for i = 1:it_ges
anzahl_ges(i) = i;
end
if(it_n < it_ges)
for i = it_n+1:it_ges
x_n(1,i) = x_n(1,i-1);
x_n(2,i) = x_n(2,i-1);
end
end
if(it_f < it_ges)
for i = it_f+1:it_ges
x_f(1,i) = x_f(1,i-1);
x_f(2,i) = x_f(2,i-1);
end
end
if(it_qn < it_ges)
for i = it_qn+1:it_ges
x_qn(1,i) = x_qn(1,i-1);
x_qn(2,i) = x_qn(2,i-1);
end
end
plot(anzahl_ges, x_n(1,:), ...
anzahl_ges, x_f(1,:), ...
anzahl_ges, x_qn(1,:), ...
anzahl_ges, x_n(2,:), ...
anzahl_ges, x_f(2,:),...
anzahl_ges, x_qn(2,:));
title('Iterationsverfahren');
legend('Theta (Newton) ','Theta (FixP)','Theta (Quasi-Newton)','Theta-Punkt (New.)','Theta-Punkt(Fixp)','Theta-Punkt(Quasi-New.)' )
xlabel('Anzahl Iterationen');
ylabel('Iterationsergebnisse');

View File

@ -0,0 +1,14 @@
%-----------------------------------------------------------------
% Die nachfolgende Funktion liefert als Rückgabewert die Matrikelnummer
% und den Namen des/der abgebenden Studenten/Studentin.
%-----------------------------------------------------------------
function [m, n, g] = matrikelnummer()
% Bitte tragen Sie hier Ihre Matrikelnummer ein:
m = 1234567;
% Bitte tragen Sie hier Ihren Namen ein:
n = 'Max Mustermann';
% Bitte tragen Sie hier zusätzlich die Matrikelnummern der Gruppen-
% mitglieder ein, mit denen Sie zusammengearbeitet haben oder lassen Sie
% die Variable unverändert:
g = [m,0,0];
end

View File

@ -0,0 +1,10 @@
function [N,X_itn] = newton(x);
% Function newton
% In: Start value
% Out: number of iteration steps, vector of solution
% Todo: Replace below code with newton method
N=1;
X_itn=x;

View File

@ -0,0 +1,9 @@
function [N,X_itn] = quasi_newton(x);
% Function quasi_newton
% In: Start value
% Out: number of iteration steps, vector of solution
% Todo: Replace below code with quasi newton method
N=1;
X_itn=x;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.