3rd or 4th order Polynomial Fitting
Show older comments
How can I solve Polynomial Fitting problem? [Input>polynomial Fitting>LMS(noise cancellation)>DCT]
x=zeros (N , 1);
d=zeros (N , 1);
for n = 1 : N
x(n) = (iTaidou_wave(n+1) .* (qTaidou_wave(n+1)-qTaidou_wave(n))- (iTaidou_wave(n+1)-iTaidou_wave(n)).* qTaidou_wave(n+1)) ./ (iTaidou_wave(n+1) + qTaidou_wave(n+1));
d0 = 1.5;
c = 3 * 10^8;
fc = 24 * 10^9;
lambda = c/fc;
% Entire movement
d(n) = ((x(n) .* lambda) ./ 4*pi) - d0;
end
% Polynomial Fitting
%Time vector
for x1 =1:0.5:5
y = d(n) * x1 ;
p = polyfit(x1,y,3);
y_fit = polyval(p,x1);
plot(x1,y,'ro',x1,y_fit)
grid on
%LMS
mu = 0.2;
lms = dsp.LMSFilter('StepSize',mu);
[y,err,wts] = lms(x1,y_fit);
1 Comment
Walter Roberson
on 12 Mar 2021
What difficulty are you having?
You overwrite y_fit for each x
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!