Skip to content

Instantly share code, notes, and snippets.

@Mebus
Last active May 15, 2017 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mebus/6ed6bbb9b3c1274c8a5a270c772123de to your computer and use it in GitHub Desktop.
Save Mebus/6ed6bbb9b3c1274c8a5a270c772123de to your computer and use it in GitHub Desktop.
Mechatronik Aufgabe 3.1
% Aufgabe 3.1
y = transpose([5.5 1.5 -3.5 4.5 8.5]);
U = [-1.5 2.5;-0.5 0.25; 4.5 20.25; 7 49; 8 64];
theta = inv((transpose(U)*U))*transpose(U) * y
y_schlange(1:5) = 0;
e = 0;
for j=1:5
y_schlange(j) = theta(1) * U(j,1) + theta(2) * U(j,1)^2;
e = e + (y(j) - y_schlange(j))^2;
end
disp('y_schlange:');
disp(y_schlange)
% Fehler bestimmen
e = 1/5*sqrt(e);
disp('e:');
disp(e);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment