hello sir i am calculating mean square for my two signals but its giving me constant mean square error..?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc
clear all
N=1024;
k=8;
d=16;
a=1;
b=5;
X=zeros(1,N);
X_p=randperm(N,k);
X_v1=rand(1,k);
X_v=a*X_v1+b;
X(X_p)=X_v;
x=ifft(X);
x1=0.1;
x2=0.5;
%X_v=[b,a+b];
X_re=zeros(1,N);
len=length(x);
% figure
% plot(x)
%
sss=4;
for l=1:sss;
xd(l,:)=downsample(x(l:len),sss);
XD(l,:)=fft(xd(l,:));
end
% plot(abs(xd(1,:)));
k_zero=[];
k_one=[];
k_two=[];
for kd=1:N/d
if XD(:,kd).^2<x1;
k_zero=[k_zero,kd];
else
if abs(XD(1,kd).^2)-(XD(2,kd).^2)<x2;
k_one=[k_one,kd];
X_k=[k_zero,k_one];
X_value1=XD(1,kd);
X_rel(X_k)=X_value1;
X_po=mean(abs(XD(1,kd)-(XD(2,kd))));
else
k_poss=[kd,kd+N/d];
% k_pair=[poss,kd+(kd-1)*(N/d)];
ss=[0,1,2,3];
kk=0;
poss=[];
for ii=1:N/d
poss=[poss,kd+(kd-1)*(N/d)];
for ii=1:length(poss)
k1=poss(ii);
for jj=kd+1:length(poss)
k2=poss(jj);
kk=kk+1;
k_p(kk,:)=[k1,k2];
A=[1, 1 ; exp(1i*2*pi*(k1-1)*(ss(2)/N)), exp(1i*2*pi*(k2-1)*(ss(2)/N));exp(1i*2*pi*(k1-1)*(ss(3)/N)) , exp(1i*2*pi*(k2-1)*(ss(3)/N)); exp(1i*2*pi*(k1-1)*(ss(4)/N)), exp(1i*2*pi*(k2-1)*(ss(4)/N))];
Aa(kk).A=A;
XF=pinv(A)*(XD(:,1));
xf(kk).XF=XF;
MSE(kk)=sum((XD(:,1))-(A*XF).^2);
end
end
end
end
end
end
plot(abs(MSE));
Réponses (0)
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!