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

📄 m_qam.m

📁 非常好的M_QAM调制解调程序
💻 M
📖 第 1 页 / 共 5 页
字号:
% =============================================%
% Programed by Rustam Efendi, STTTelkom Bandung.
% efendi_rustam@yahoo.com
% Open for correction or any comments.
% =============================================%

function varargout = M_QAM(varargin)
global SNR_max jml_itr BR kanal rolloff M snr orde Alpha t Bit Split_Od ...
    Split_Ev Lsymbol_Od Lsymbol_Ev ttt LshapedI LshapedQ  Yinphase Yquadrat ...
    Yqam Yqamrx DemodI DemodQ LdetI LdetQ recLsymbolI recLsymbolQ ...
    rxdibitI rxtribitI rxfourbitI rxdibitQ rxtribitQ rxfourbitQ ...
    quadratosc inphaseosc recbit RayL rrcfilter fad1 nsamp Yqamj Yqamrxj ...
    LcompI LcompQ Lsymbolods Lsymbolevs bit_frame bit_frame_split bagi_waktu ...
    Bit_Masukan fs Lsymbolod Lsymbolev QQQ III rolloff

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @M_QAM_OpeningFcn, ...
                   'gui_OutputFcn',  @M_QAM_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before M_QAM is made visible.
function M_QAM_OpeningFcn(hObject, eventdata, handles, varargin)
bg=imread('M_QAM.bmp');
axes(handles.axes1);
imshow(bg);

handles.output = hObject;
guidata(hObject, handles);


% --- Outputs from this function are returned to the command line.
function varargout = M_QAM_OutputFcn(hObject, eventdata, handles) 
% Get default command line output from handles structure
varargout{1} = handles.output;
atas(gcf)
clear all;


% --- popupmenu ---
function popupmenu1_Callback(hObject, eventdata, handles)
function popupmenu1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function popupmenu2_Callback(hObject, eventdata, handles)
function popupmenu2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function popupmenu3_Callback(hObject, eventdata, handles)
function popupmenu3_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function popupmenu4_Callback(hObject, eventdata, handles)
function popupmenu4_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function popupmenu5_Callback(hObject, eventdata, handles)
function popupmenu5_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function popupmenu6_Callback(hObject, eventdata, handles)
function popupmenu6_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- edit ---
function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
function edit3_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
function edit4_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- pushbutton ---
function pushbutton1_Callback(hObject, eventdata, handles) % info
global t Bit bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
stairs(t,Bit), grid on; axis([0 bit_frame -0.1 1.1]); 
title('Input Bit'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2)
fs = length(Bit) - 1;
f_dom = fft(Bit);
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('Input Bit');xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end


function pushbutton2_Callback(hObject, eventdata, handles) % info I
global t Split_Od bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1) 
stairs(t,Split_Od), grid on,axis([0 bit_frame -0.1 1.1]); 
title('Inphase Bit (Splitter Out)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Split_Od) - 1;
f_dom = fft(Split_Od);
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 Bit (Splitter Out)');xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton3_Callback(hObject, eventdata, handles) % info Q
global t Split_Ev bit_frame
if isempty(t)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
figure('Position',pos1)
stairs(t,Split_Ev), grid on,axis([0 bit_frame -0.1 1.1]); 
title('Quadrature Bit (Splitter Out)'); xlabel('Time)'); ylabel('Amplitude (V)')
figure('Position',pos2)
fs = length(Split_Ev) - 1;
f_dom = fft(Split_Ev);
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 Bit (Splitter Out)');xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton4_Callback(hObject, eventdata, handles) % l conv I
global t Lsymbol_Od 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) 
stairs(t,Lsymbol_Od), grid on,axis([0 bit_frame -X X]); 
title('Multilevel Inphase Signal'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Lsymbol_Od) - 1;
f_dom = fft(Lsymbol_Od);
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('Multilevel Inphase Signal'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton5_Callback(hObject, eventdata, handles) % l conv Q
global t Lsymbol_Ev 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) 
stairs(t,Lsymbol_Ev), grid on,axis([0 bit_frame -X X]); 
title('Multilevel Quadrature Signal'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(Lsymbol_Ev) - 1;
f_dom = fft(Lsymbol_Ev);
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('Multilevel Quadrature Signal'); xlabel('Frequency'); ylabel('Normalized Power (dBw)')
end;


function pushbutton6_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('Carrier Signal of IF Quadrature Modulator'); 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('Carrier Signal of IF Quadrature Modulator'); xlabel('Frequency (Hz)'); ylabel('Normalized Power (dBw)')
end;


function pushbutton7_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('Carrier Signal of IF Inphase Modulator'); 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('Carrier Signal of IF Inphase Modulator'); xlabel('Frequency (Hz)'); ylabel('Normalized Power (dBw)')
end;


function pushbutton8_Callback(hObject, eventdata, handles) % fil I
global t ttt LshapedI orde bit_frame bagi_waktu Bit_Masukan
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
tt = ttt*Bit_Masukan;
figure('Position',pos1) 
plot(tt,LshapedI), grid on,axis([0 bit_frame min(LshapedI) max(LshapedI)]); %stairs
title('Multilevel Inphase Signal (Filter Out)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(LshapedI) - 1;
f_dom = fft(LshapedI);
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('Multilevel Inphase Signal (Filter Out)'); xlabel('Frequency');ylabel('Normalized Power (dBw)')
end;


function pushbutton9_Callback(hObject, eventdata, handles) % fil Q
global t ttt LshapedQ orde bit_frame bagi_waktu Bit_Masukan
if isempty(ttt)==1
    msgbox('Push "Submit" !');
else
[pos1 pos2]=posisi_grafik;
tt = ttt*Bit_Masukan;
figure('Position',pos1) 
plot(tt,LshapedQ), grid on,axis([0 bit_frame min(LshapedQ) max(LshapedQ)]); %stairs
title('Multilevel Quadrature Signal (Filter Out)'); xlabel('Time'); ylabel('Amplitude (V)')
figure('Position',pos2) 
fs = length(LshapedQ) - 1;
f_dom = fft(LshapedQ);
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('Multilevel Quadrature Signal (Filter Out)'); xlabel('Frequency');ylabel('Normalized Power (dBw)')
end;


function pushbutton10_Callback(hObject, eventdata, handles) % mix I
global ttt Yinphase bit_frame bagi_waktu
if isempty(ttt)==1

⌨️ 快捷键说明

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