How can I write code for zero mean and scaling for a matrix of m*n dimension?

조회 수: 4 (최근 30일)
I am having matrix of dimension m*n and want to compute zero mean of that matrix and then scaled to it for providing a error value ?

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 9일
newmatrix = yourmatrix - mean2(yourmatrix);
newmatrix = newmatrix ./ max(abs(newmatrix(:)));
  댓글 수: 4
RS
RS 2013년 3월 29일
I have this data as X data column
  1. [624.0397 743.4188 641.3096 764.2928 698.1912 832.8933 799.6397 767.3729 735.1792 703.093 671.0012 638.9143 605.9839 668.0182 0 0 0 0 0 0]
Y column
  1. [8.071650105 8.144216751 8.177926597 8.171846343 8.073710465 7.999249364 8.00676841 8.064808175 8.061246346 8.064100517 8.041524691 8.045426565 8.068412239 8.225694432 0 0 0 0 0 0]
and want to smooth, cosine fit and want to compute residual for this I have tried
x=[];
y=[];
for j=1:519
x=AC(:,j+1);
y=AC(:,j);
xx=find(y);
xxx=max(xx);
y1=smooth(x,y(1:xxx),'moving',5);
fitted_curve=cos(x);
end
errors are ??? Error using ==> smooth at 131 X and Y must be the same length.
So how can I fit in cosine and compute residual of fit.
RS
RS 2013년 4월 2일
I have this data as X data column
1. [624.0397 743.4188 641.3096 764.2928 698.1912 832.8933 799.6397 767.3729 735.1792 703.093 671.0012 638.9143 605.9839 668.0182 0 0 0 0 0 0]
Y column
1. [8.071650105 8.144216751 8.177926597 8.171846343 8.073710465 7.999249364 8.00676841 8.064808175 8.061246346 8.064100517 8.041524691 8.045426565 8.068412239 8.225694432 0 0 0 0 0 0]
As the same way I am having data set for third column having x data set and again fourth column I am having y data set as so on upto 520, and also all having same number of element mean column having same number of element and some zero values also.
and want to smooth, cosine fit and want to compute residual for this I have tried
x=[];
y=[];
for j=1:519
x=AC(:,j+1);
y=AC(:,j);
xx=find(y);
xxx=max(xx);
y1=smooth(x,y(1:xxx),'moving',5);
fitted_curve=cos(x);
end
errors are ??? Error using ==> smooth at 131 X and Y must be the same length.
So how can I fit in cosine and compute residual of fit.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by