Match Filter and Sampling problem

9 ビュー (過去 30 日間)
Durgaprasad Srinivasa
Durgaprasad Srinivasa 2019 年 10 月 30 日
コメント済み: Subhadeep Koley 2019 年 11 月 5 日
clc;
clear all;
close all;
tp=2.2676*10^-3;
Ts=22.6757*10^-6;
fc=4000;
Tc=(1/fc);
fs=44100;
n=0:Ts:1000;
fp=(1/tp);
w=2*pi*fp;
p=sin(w*n*Ts);
p(find(p<0))=0;
figure(1)
subplot(3,1,1);
plot(n,p);
data = randi([0,1],1,1000);
a=[];
for k=1:2:1000
if data(k)==0 && data(k+1)==0
a=[a 1];
elseif data(k)==0 && data(k+1)==1
a=[a i];
elseif data(k)==1 && data(k+1)==0
a=[a -1];
elseif data(k)==1 && data(k+1)==1
a=[a -i];
end
end
figure(2)
subplot(3,1,2);
y_s=conv(a,p);
Trm=min(numel(n),numel(y_s))
n=n(1:Trm);
y_s=y_s(1:Trm);
plot (n,real(y_s), '-',n,imag(y_s), '--');
%% modulation of 2 signals
figure(3)
subplot(3,1,3);
in_phase_carrier=cos(2*pi*fc*n*Ts);
q_phase_carrier=sin(2*pi*fc*n*Ts);
y_m=real(y_s).*in_phase_carrier+imag(y_s).*q_phase_carrier;
plot (n,real(y_m), '-');
subplot(3,2,3);
plot(n,imag(y_m), '--');
pav=sum(y_m.^2)/length(y_m);
et=sum(y_m.^2)/fs;
snrdb=20;
snrlin=10.^(snrdb./10);
eb=sum(y_m.^2)/length(y_m);
u=0.00022676;
g=5/60;
n1=(u-n);
in_phase_carrier_rec=cos(2*pi*fc*n1*Ts);
q_phase_carrier_rec=sin(2*pi*fc*n1*Ts);
y_mn1=(real(y_s).*in_phase_carrier_rec)+(imag(y_s).*q_phase_carrier_rec);
figure(4)
subplot(4,1,4);
r = (sqrt((1-g)^2))*y_m+y_mn1*g;
plot(n,r);
snrdb=20;
snrlin=10.^(snrdb/10);
n0 = eb/snrlin;
sigma=(n0.*fs)/2;
noise = sqrt(sigma).*randn(1,length(y_m));
recieved=noise+r;
%% demodulation of signal
subplot(4,2,4);
r_dm_in=real(recieved).*in_phase_carrier;
plot(n,r_dm_in,'-');
r_dm_out=imag(recieved).*q_phase_carrier;
plot(n,r_dm_out,'--');
Hello I am trying to demodulate using match filter and sampling it wwith 44100Hz. can anyone help with match filter and sampling of this code.
  1 件のコメント
Subhadeep Koley
Subhadeep Koley 2019 年 11 月 5 日
Your code is running without an error. Can you elaborate what problem exactly you are facing? What is you expecting as the output?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by