how to remove error from this code

12 ビュー (過去 30 日間)
Nazi khan
Nazi khan 2016 年 4 月 10 日
コメント済み: Image Analyst 2016 年 4 月 10 日
a = 1000;
a = randi([-1 1],a,1);
b= (a >= 0);
bm=(a<0);
b1(b)=1;
b1(bm)=-1;
d=b1(:);
h=[1 0.25 -0.5];
c=conv(h,d);
e=c(1:end-2,:);
noise1 =normrnd(0,0.1,[length(e)],1); % noise signal of zero mean and 0.1 variance
f1=e+noise1;
t=f1(1:end-990,:); %take 10 values
ss = 16; % NLMS step size
offset = 50; % NLMS offset
ha = adaptfilt.nlms(3,ss,1,offset);
stem([h', ha.coefficients']);
legend('Actual','Estimated');
xlabel('Coefficient number'); ylabel('Coefficient Value');
l=deconv(f1,ha.coefficients);
idmax = (l > 0);
idmin = (l < 0);
l1(idmax) = 1;
l1(idmin) = -1;
ll=[l1 0 0];
Y1 = ll(:);
p1=0;
q1=0;
for i=1:1000
if(ll(i)==d(i))
p1=p1+1;
else
q1=q1+1;
end
end
pe1=(q1/1000);
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 4 月 10 日
You appear to have one variable named l1 and another named ll. That is legal but it is hard on the readers whose vision is no longer perfect.
Image Analyst
Image Analyst 2016 年 4 月 10 日
Do you mean this error:
Undefined variable "adaptfilt" or class "adaptfilt.nlms".
Error in test1 (line 16)
ha = adaptfilt.nlms(3,ss,1,offset);
If so, it's probably that you don't have the proper toolbox installed.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by