I got error -- Error using + Matrix dimensions must agree.
on this code. Please help me
a=sign(X(ind1)).*(abs(X(ind1))-T);
b=abs(X);
c=plus(a,b);

 채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 16일
편집: Mischa Kim 2014년 3월 16일

0 개 추천

Nik, X and T need to be same-sized vectors unless T is a scalar.
What are you trying to do in
a = sign(X(ind1)).*(abs(X(ind1))-T);
especially w.r.t. T?

댓글 수: 3

i'm trying to add the hard threshold with soft threshold value. the original hard threshold func is:
function op=hthresh(X,T);
ind=find(abs(X)<=T);
X(ind)=0;
op=X;
and the soft threshold is:
function op=sthresh(X,T);
ind=find(abs(X)<=T);
ind1=find(abs(X)>T);
X(ind)=0;
X(ind1)=sign(X(ind1)).*(abs(X(ind1))-T);
op=X;
now, im trying to get the average of absolute value of this 2 function:
function op=avthresh(X,T);
a=sign(X(ind1)).*(abs(X(ind1))-T);
b=abs(X);
c=plus(a,b);
d= abs(c);
X(ind1)= d/2;
op=X;
which I got error matrix dimension must agree.
Then, I change it to this one, it works but then the image and PSNR value is very bad..
function op=avthresh(X,T);
a=sign(X(ind1)).*(abs(X(ind1))-T);
b=numel(a);
c=abs(X);
d=numel(c);
e=plus(b,d);
f=abs(e/2);
X(ind1)=f;
op=X;
seek for your advice.. tq in advance
Mischa Kim
Mischa Kim 2014년 3월 18일
What are the sizes of X and T? Is T a scalar?
Nik
Nik 2014년 3월 19일
편집: Nik 2014년 3월 19일
Sir Mischa, T is:
M=size(pic,1)^2;
T=sig*sqrt(2*log(M));
while X is the wavelet coefficient value. TQVM.

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

추가 답변 (0개)

카테고리

태그

질문:

Nik
2014년 3월 16일

편집:

Nik
2014년 3월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by