Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc;
- clear all;
- close all;
- load('lab8_4.mat');
- yid = id.Y;
- uid = id.U;
- plot(id)
- counter = 1;
- theta(:,counter) = [.20; 1];
- alpha = 0.00001;
- N = length(yid);
- [E,e]=epsilon(theta,uid,yid,N);
- V=gradient(E,e,N);
- H=hessian(e,N);
- theta(:, counter+1) = theta(:,counter) - alpha*inv(H)*V;
- counter = counter + 1;
- while (counter <= N || norm(theta(:,counter) - theta(:,counter-1)) >= 1e-6)
- [E,e]=epsilon(theta,uid,yid,N);
- V=gradient(E,e,N);
- H=hessian(e,N);
- theta(:, counter+1) = theta(:,counter) - alpha*inv(H)*V;
- counter = counter+1;
- end
- thetap = theta(:, counter);
- B=[0 thetap(2,1)];
- F=[1 thetap(1,1)];
- model = idpoly(1,B,1,1,F,0,id.Ts);
- figure;
- compare(model, val);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement