Explain how a line codificator works

3 views (last 30 days)
Jhon Rackham
Jhon Rackham on 28 Apr 2020
Hi guys, I need your help. I'm working on a LINE CODIFICATOR, I've found all the code and all my project is done, but I need explain the source code and How It works.
Please, this is my final project and I have to do a sustentation, this is one of my GUIs and all the code:
Code for UNIPOLAR NRZ:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.uno,'string','')
set(handles.dos,'string','')
set(handles.tres,'string','')
set(handles.cuatro,'string','')
set(handles.cinco,'string','')
set(handles.seis,'string','')
set(handles.siete,'string','')
set(handles.ocho,'string','')
set(handles.nueve,'string','')
set(handles.diez,'string','')
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=str2double(get(handles.uno,'String'));
b=str2double(get(handles.dos,'String'));
c=str2double(get(handles.tres,'String'));
d=str2double(get(handles.cuatro,'String'));
e=str2double(get(handles.cinco,'String'));
f=str2double(get(handles.seis,'String'));
g=str2double(get(handles.siete,'String'));
h=str2double(get(handles.ocho,'String'));
i0=str2double(get(handles.nueve,'String'));
j0=str2double(get(handles.diez,'String'));
handles.bits=[a,b,c,d,e,f,g,h,i0,j0];
handles.cod=get(hObject,'Value');
hold off;
h=handles.bits;
n=1;
h(11)=1;
while n<=10;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
y=(t==n);
end
d=plot(t,y);title('Código Unipolar NRZ');grid on
set(d, 'Color','m')
set(d,'LineWidth',2.5);
hold on;
axis([0 10 -1.5 1.5]);
else
if h(n+1)==0
y=(t<n)-0*(t==n);
else
y=(t<n)+1*(t==n);
end
d=plot(t,y);title('Código Unipolar NRZ');grid on;
set(d, 'Color','g')
set(d,'LineWidth',2.5);
hold on;
axis([0 10 -1.5 1.5]);
end
n=n+1;
end

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!