Non Linear Regression Problem
Afficher commentaires plus anciens
I have tried to attempt this question however I don't know if I'm on the right track. I have already done (i), my difficulty is in (ii).
clear all
clc
syms x y a b
X=[1:1:10];
Y=[0.5379,0.827,1.2654,1.5324,1.717,1.3983,1.6844,1.6892,1.506,1.707];
a = [1;0;0;0;0;0;0;0;0;0;0];
b = [1;0;0;0;0;0;0;0;0;0;0];
c = [0;0;0;0;0;0;0;0;0;0;0];
u = [((a(1)*x)/(b(1)+x)) , ((a(1)*2*x)/(b(1)+2*x)), ((a(1)*3*x)/(b(1)+3*x)), ((a(1)*4*x)/(b(1)+4*x)), ((a(1)*5*x)/(b(1)+5*x)), ((a(1)*6*x)/(b(1)+6*x)), ((a(1)*7*x)/(b(1)+7*x)), ((a(1)*8*x)/(b(1)+8*x)), ((a(1)*9*x)/(b(1)+9*x)), ((a(1)*10*x)/(b(1)+10*x))]';
B0=[a(1);b(1)];
U = [0;0;0;0;0;0;0;0;0;0;0];
for i=2:11
U(i-1) = [((a(i-1)*1)/(b(i-1)+1)) , ((a(i-1)*2)/(b(i-1)+2)), ((a(i-1)*3)/(b(i-1)+3)), ((a(i-1)*4)/(b(i-1)+4)), ((a(i-1)*5)/(b(i-1)+5)), ((a(i-1)*6)/(b(i-1)+6)), ((a(i-1)*7)/(b(i-1)+7*x)), ((a(i-1)*8)/(b(i-1)+8)), ((a(i-1)*9)/(b(i-1)+9)), ((a(i-1)*10)/(b(i-1)+10))]';
Jac = jacobian([((a*1)/(b+1)) , ((a*2)/(b+2)), ((a*3)/(b+3)), ((a*4)/(b+4)), ((a*5)/(b+5)), ((a*6)/(b+6)), ((a*7)/(b+7)), ((a*8)/(b+8)), ((a*9)/(b+9)), ((a*10)/(b+10))], [a,b] );
r = u - U(i-1);
c = [a(i-1);b(i-1)] - inv(J(i-1)'.* J(i-1)).*(J(i-1)'.*r(i-1));
c
a(i) = c(1);
b(i) = c(2);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Linear Predictive Coding dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
