|
Raqamli aloqa 3-9-Amaliy ishlar
|
bet | 2/6 | Sana | 28.12.2023 | Hajmi | 2,71 Mb. | | #128837 |
Bog'liq Ozodbek raqamli 3-9 amaliy to\'liq ish#4 Digital communication
Simulation of Phase modulation
Matlab code:
clear all
Am=2;
Ac=1;
fc=75; % fc ni FR ga bog’liq holda ixtiyoriy oldim.
fm=1; %fm ni nisbatiga ko’ra ixtiyoriy oldim.
h=22
phaase=3.5;
davr=45;
j=1;
for i=1:45000 % t(i) dan foydalangan holda I maxni topvoldim.
t(i)=i/6280; %bunda man I maxni toppish qulay bo’lish maqsadida pi ga qisqaradigan qilib 6280 ni oldim.
m(i)= Am*cos(2*pi*fm*t(i)+2*phaase);
c(i)=Ac*sin(2*pi*fc*t(i));
s(i)=Ac*sin(2*pi*fc*t(i)-h*sin(2*pi*fm*t(i)+2*phaase));
if i>2 && s(i-2)s(i)
ext_p_t(j)=t(i);
j=j+1;
end
end
Fmin=1000; Fmax=-1000;
k=1;
for i=2:j-1
freq=1/(ext_p_t(i)-ext_p_t(i-1));
if freqFmin=freq;
end
if freq>Fmax
Fmax=freq;
end
end
dfc=(Fmax+Fmin)/2 % dfc o'zgaruvchisiga Fmax va Fmin o'zgaruvchilarining o'rtacha qiymati olinadi.
dh=(Fmax-Fmin)/2/fm
clf
subplot(4,1,1);
plot(t,m);
yline(0);
xlabel("t");
subplot(4,1,2);
plot(t,c);
yline(0);
xlabel("t"); % X o'qi (xlabel) uchun matnni sozlash: "t".
subplot(4,1,3);
plot(t,s);
xlabel("t");
yline(0);
subplot(4,1,4);
xline(round(Fmin),'-',round(Fmin))
xline(round(Fmax),'-',round(Fmax))
xline(round(dfc),'-',round(dfc))
xlabel("f");
Bu fazali modulyatsiya hisoblanadi, bunda faza bo’yicha bo’ladigan o’zgarishlarni modulyatsiyasi shakli hisoblandi.Bu jarayonda ham biz davrdan foydalangan holda I maxni topvoldim va keyinggi amallarni bajardim.
#5 Digital communication
Simulation of Amplitude Shift Keying
Matlab code:
clear all
char=double('LED') %charda LED yozuvini kiritib oldim.
Ac=3.5;
fc=6;
i=1;
for cc=1:length(char)
for n=0:7
bit_n=bitshift(char(cc),-n); %n marta o’nga surilib 1 ga mantiqiy ko’paytiriladi.
a(i) = bitand(bit_n,1);
a(i+1)=a(i);
t1(i) = (cc-1)*8+n;
t1(i+1) = t1(i)+1;i=i+2
end;end
for j=1:length(char)*4000-1 %char da berilga o’zgaruvchi uzunligi olinadi.
t2(j)=j/500;
n=floor(t2(j)*2+1);
c(j)=Ac*cos(2*pi*fc*t2(j));
s(j)=c(j)*a(n);
end
subplot(4,1,1);
plot(t1,a);
subplot(4,1,2);
plot(t2,c);
subplot(4,1,3);
plot(t2,s);
time_counter=1;
one_counter=0;sample_counter=0;
for k=1:length(t2)
if t2(k)sample_counter=sample_counter+1;
if abs(s(k))>Ac/2
one_counter=one_counter+1;
end
else
t_data(time_counter)=time_counter
if one_counter>sample_counter/4
data(time_counter)=1;
else
data(time_counter)=0;end
time_counter=time_counter+1;
one_counter=0;sample_counter=0;
end
end
k2=1;
for k=1:length(data) % data massivining har bir elementi uchun tsikl ochiladi.
p_data(k2)=data(k);
p_data(k2+1)=data(k);
p_t_data(k2)= t_data(k)-1;
p_t_data(k2+1)= t_data(k);
k2=k2+2
end
subplot(4,1,4);
plot(p_t_data,p_data);
Bu jarayonda birinchi fizikavi modelini tuzdim, ya’ni bunda amplituda siljishini fizikaviy modelini tuzvoldim, bunda differensial tenglamalar ham tuzish mumkin va h.z, oxirida man natijasini oldim.Mani variantim bo’yicha berilgan DRY yozuvini char da kiritvoldim.
|
| |