⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_qam.m

📁 非常好的M_QAM调制解调程序
💻 M
📖 第 1 页 / 共 5 页
字号:
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(ttt(1:floor((length(ttt))/bagi_waktu)),Yinphase(1:floor((length(ttt))/bagi_waktu))), grid on;
title('QAM Inphase Signal'); xlabel('Time (normalized)'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Yinphase) - 1;
f_dom = fft(Yinphase);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('QAM Inphase Signal'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton11_Callback(hObject, eventdata, handles) % mix Q
global ttt Yquadrat bit_frame bagi_waktu
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(ttt(1:floor((length(ttt))/bagi_waktu)),Yquadrat(1:floor((length(ttt))/bagi_waktu))), grid on;
title('QAM Quadrature Signal'); xlabel('Time (normalized)'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Yquadrat) - 1;
f_dom = fft(Yquadrat);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('QAM Quadrature Signal'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton12_Callback(hObject, eventdata, handles) % adder
global ttt Yqam bit_frame bagi_waktu
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(ttt(1:floor((length(ttt))/bagi_waktu)),Yqam(1:floor((length(ttt))/bagi_waktu))), grid on;
title('QAM Signal'); xlabel('Time (normalized)'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Yqam) - 1;
f_dom = fft(Yqam);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('QAM Signal'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton13_Callback(hObject, eventdata, handles) % ray
global ttt kanal RayL bit_frame bagi_waktu
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
if kanal == 2
    [pos1 pos2]=posisi_grafik;
    figure('Position',pos1) 
    plot(ttt(1:floor((length(ttt))/bagi_waktu)),RayL(1:floor((length(ttt))/bagi_waktu))), grid on;
    title('QAM Signal at Rayleigh Channel'); xlabel('Time (normalized)'); ylabel('Amplitude (V)')
    figure('Position',pos2) 
    fs = length(RayL) - 1;
    f_dom = fft(RayL);
    f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
    ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
    plot(ty,f_dom); grid on;
    title('QAM Signal at Rayleigh Channel'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
else
    msgbox('No picture, because selected channel is AWGN.');
end
end;


function pushbutton14_Callback(hObject, eventdata, handles) % awgn
global ttt Yqamrx kanal bit_frame bagi_waktu
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
if kanal == 1
    [pos1 pos2]=posisi_grafik;
    figure('Position',pos1) 
    plot(ttt(1:floor((length(ttt))/bagi_waktu)),Yqamrx(1:floor((length(ttt))/bagi_waktu))), grid on;
    title('Sinyal QAM Keluaran Kanal AWGN'); xlabel('Time (ternormalisasi terhadap jumlah simbol)'); ylabel('Amplitude (V)')
    figure('Position',pos2) 
    fs = length(Yqamrx) - 1;
    f_dom = fft(Yqamrx);
    f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
    ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
    plot(ty,f_dom); grid on;
    title('Sinyal QAM Keluaran Kanal AWGN'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
else 
    [pos1 pos2]=posisi_grafik;
    figure('Position',pos1) 
    plot(ttt(1:floor((length(ttt))/bagi_waktu)),Yqamrx(1:floor((length(ttt))/bagi_waktu))), grid on;
    title('Sinyal QAM Keluaran Kanal Rayleigh + AWGN'); xlabel('Time (ternormalisasi terhadap jumlah simbol)'); ylabel('Amplitude (V)')
    figure('Position',pos2) 
    fs = length(Yqamrx) - 1;
    f_dom = fft(Yqamrx);
    f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
    ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
    plot(ty,f_dom); grid on;
    title('Sinyal QAM Keluaran Kanal Rayleigh + AWGN'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end
end;


function pushbutton15_Callback(hObject, eventdata, handles) % sin
global ttt quadratosc bit_frame fs
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(ttt(1:floor((length(ttt))./10)),quadratosc(1:floor((length(ttt))./10))), grid on;
title('Sinyal Carrier IF Inphase Demodulator'); xlabel('Time (s)'); ylabel('Amplitude (V)')
figure('Position',pos2) 
f_dom = fft(quadratosc);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Sinyal Carrier IF Inphase Demodulator'); xlabel('Frequency (Hz)'); ylabel('Normalized Power (dBw)')
end;


function pushbutton16_Callback(hObject, eventdata, handles) % cos
global ttt inphaseosc bit_frame fs
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(ttt(1:floor((length(ttt))./10)),inphaseosc(1:floor((length(ttt))./10))), grid on;
title('Sinyal Carrier IF Quadrature Demodulator'); xlabel('Time (s)'); ylabel('Amplitude (V)')
figure('Position',pos2) 
f_dom = fft(inphaseosc);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Sinyal Carrier IF Quadrature Demodulator'); xlabel('Frequency (Hz)'); ylabel('Normalized Power (dBw)')
end;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function pushbutton17_Callback(hObject, eventdata, handles) % mix I
global ttt DemodI orde bit_frame bagi_waktu Bit_Masukan
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
tt = ttt*Bit_Masukan;
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(tt,DemodI), grid on, axis([0 bit_frame min(DemodI) max(DemodI)]);
title('Inphase Signal (Mixing Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(DemodI) - 1;
f_dom = fft(DemodI);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Inphase Signal (Mixing Output)'); xlabel('Frequency'); ylabel('Frequency (dBw)')
end;


function pushbutton18_Callback(hObject, eventdata, handles) % mix Q
global ttt DemodQ orde bit_frame bagi_waktu Bit_Masukan
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
tt = ttt*Bit_Masukan;
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(tt,DemodQ), grid on, axis([0 bit_frame min(DemodQ) max(DemodQ)]);
title('Quadrature Signal (Mixing Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(DemodQ) - 1;
f_dom = fft(DemodQ);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Quadrature Signal (Mixing Output)'); xlabel('Frequency');ylabel('Frequency (dBw)')
end;


function pushbutton19_Callback(hObject, eventdata, handles) % fil I
global t ttt LdetI orde bit_frame bagi_waktu
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(t,LdetI), grid on, axis([0 bit_frame min(LdetI) max(LdetI)]);
title('Inphase Signal (Filter Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(LdetI) - 1;
f_dom = fft(LdetI);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Inphase Signal (Filter Output)'); xlabel('Frequency'); ylabel('Frequency (dBw)')
end;


function pushbutton20_Callback(hObject, eventdata, handles) % fil Q
global t ttt LdetQ orde bit_frame bagi_waktu
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
plot(t,LdetQ), grid on, axis([0 bit_frame min(LdetQ) max(LdetQ)]);
title('Quadrature Signal (Filter Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
figure('Position',pos2) 
fs = length(LdetQ) - 1;
f_dom = fft(LdetQ);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Quadrature Signal (Filter Output)'); xlabel('Frequency'); ylabel('Frequency (dBw)')
end;


function pushbutton21_Callback(hObject, eventdata, handles) % dec I
global t recLsymbolI orde bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
if orde == 1
    X = 4;
elseif orde == 2
    X = 8;
elseif orde == 3
    X = 16;
end
figure('Position',pos1) 
plot(t,recLsymbolI), grid on, axis([0 bit_frame -X X]);
title('Inphase Signal (Detector Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(recLsymbolI) - 1;
f_dom = fft(recLsymbolI);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Inphase Signal (Detector Output)'); xlabel('Frequency'); ylabel('Frequency (dBw)')
end;


function pushbutton22_Callback(hObject, eventdata, handles) % dec Q
global t recLsymbolQ orde bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
if orde == 1
    X = 4;
elseif orde == 2
    X = 8;
elseif orde == 3
    X = 16;
end
figure('Position',pos1) 
plot(t,recLsymbolQ), grid on, axis([0 bit_frame -X X]);
title('Quadrature Signal (Detector Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(recLsymbolQ) - 1;
f_dom = fft(recLsymbolQ);
f_dom = 20*log10(abs((f_dom(1:length(f_dom)/2+1))./(max(abs(f_dom))) + 1e-30));
ty = [0:length(f_dom)-1]*fs/length(f_dom)/2;
plot(ty,f_dom); grid on;
title('Quadrature Signal (Detector Output)'); xlabel('Frequency'); ylabel('Frequency (dBw)')
end;


function pushbutton23_Callback(hObject, eventdata, handles) % l conv I
global t rxdibitI rxtribitI rxfourbitI orde bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
if orde == 1
    Y = rxdibitI;
elseif orde == 2
    Y = rxtribitI;
elseif orde == 3
    Y = rxfourbitI;
end
figure('Position',pos1) 
stairs(t,Y), grid on, axis([0 bit_frame -0.1 1.1]);
title('Inphase Signal (Level Converter Output)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -