Least_mean Squares
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to write the below function.

for(ct = 1:N )
sum_xy = sum_xy + x(ct)*y(ct) ;
sum_xx = sum_xx + x(ct)*x(ct) ;
sum_x= sum_x+x(ct)
sum_y = sum_y+y(ct)
end
% Compute best value of b
%b_tilde = sum_xy / sum_xx ;
b_tilde = (sum_xy - ((1/N)*sum_x*sum_y))/(sum_xx-((1/N)*sum_xx));
fprintf(1,'b_tilde is %1.10f \n',b_tilde) ;
I havent done a_tilde yet but i presume its (sum_y/N) - b_tilde*(sum_x/N)
any advice appreciated.
0 Kommentare
Antworten (1)
Star Strider
am 27 Mär. 2021
2 Kommentare
Star Strider
am 30 Mär. 2021
The way to test that is to produce some data with a known slope and intercept, and see if your code reproduces those parameters.
Meanwhile use the sum and mean functions to make your ocde easier to write and execute.
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!