0
$\begingroup$

i get a huge gap in my starting position between Dc and Dm and although they both go down in each itteration,still the gap is so huge that when one comes close to zero the other is still very large and i get error function of 6 at best,as shown in the photos bellow. What could be done to create more balance between Dc and Dm or make Dm to reduce faster ? Thanks.

my matlab code: x_data=[1:2*n]'; %2NX1

real_data=[m10;m5];%our data which we try to aproximate 2NX1

pred_m=[repmat([0.4238,-106.0187],n,1); repmat([0.2895,-69.7404],n,1)];%prediction matrices 2NX2

for k=1:itter

B=[t0,t1]';% coefficient for prediction matrices 2X1

h_pred=pred_m*B; %2NX2 X 2X1= 2NXY hipothesys vector prediction

Dm=(2/(2*n))*sum((h_pred-real_data).*x_data);

Dc=(2/(2*n))*sum((h_pred-real_data));

t0=t0-L*Dm;

t1=t1-L*Dc;

E=(1/(n))*sum((real_data-h_pred).^2); %error function

if (E<0.01) break; end end

enter image description here

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.