필터 지우기
필터 지우기

Smoothing by Least Square Technique !!!

조회 수: 1 (최근 30일)
Serhat
Serhat 2014년 5월 21일
답변: Star Strider 2014년 5월 21일
Hi all,
We are trying to find coefficients ' a 's for a given 200x1 t and 200x1 r(t)
r(t) = [ 1530 1215 3243 1111 ..... ]' size: 200 x 1
t = [0:0.5:99.5] size: 200 x 1
N=200
Thanks :)

채택된 답변

Star Strider
Star Strider 2014년 5월 21일
Interesting problem. The system is essentially this matrix equation:
r = A*[t^n]
where r, t and n are defined by necessity as column vectors and A is the matrix of coefficients. This is the inverse of the usual least-squares problem:
t = 0:0.5:99.5; % Define ‘t’
n = 0:length(t)-1; % Define ‘n’
tn = t.^n; % Define ‘t^n’
r = [1530 1215 3243 1111]'; % Given ‘r’ vector
stn = tn(1:length(r))'; % Truncate length of ‘tv’ to match sample ‘r’
stn(1) = eps; % Replace zero with ‘eps’ in ‘stv’
stni = pinv(stn); % Take pseudo-inverse of ‘t^n’
A = r*stni % Calculate ‘A’ coefficient matrix
rt = A*stn % Verify ‘A’ calculation
At least for the data available, this works!

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 5월 21일
See my attached demo for polyfit.
  댓글 수: 2
Serhat
Serhat 2014년 5월 21일
In your code, you give constant values for slope,intercept etc.
But, we dont have these values. We want to find the polynomial coeffcients which best fits the our original data. We just have the data vectors.
Thanks
Image Analyst
Image Analyst 2014년 5월 21일
I did not give constants for them. I computed all the coefficients (slope and intercept). Look again, specifically for these lines where I calculate them:
% Do the regression with polyfit
linearCoefficients = polyfit(x, y, 1)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by