Revision [11106]

This is an old revision of pinv made by ToBo on 2010-08-07 23:00:20.

 

Die Pseudoinverse


Least-Squares-Fit mit der Pseudoinversen mit der Pseudoinversen


Betrachtet wird die Funktion

ys= 5*x.^2 + 7*x - 50 + .5*exp(x)

im Intervall [-10,8]


clc
x=-10:.5:8;
x=x';
ys=  5*x.^2   +   7*x   -   50   +   .5*exp(x);
y = ys + randn(size(ys))*20; % Rauschen hinzufügen
plot(x,y,'x');
grid;

o=ones(size(x));

A = [ x.^2  x  o  exp(x) ];    % Die Theoretisch angenommene Funktion y=f(x)

b=pinv(A)*y %Lösungdes Gleichungsystems

yp = b(1)*x.^2 + b(2)*x + b(3) + b(4)*exp(x);   % Die Lösung
hold on
plot(x,ys,'y');
plot(x,yp,'r');
legend('Data points','Original function','Fitted function')
hold off



image


b =
	4.97414
	7.55254
  -50.54712
	0.50782



Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki