- refactored

This commit is contained in:
2022-06-30 13:32:40 +02:00
parent 77cd5261b1
commit 776932e5d1
144 changed files with 0 additions and 38 deletions
+30
View File
@@ -0,0 +1,30 @@
## Copyright (C) 2018 Jens Ahrensfeld
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {Function File} {@var{retval} =} lfsr (@var{input1}, @var{input2})
##
## @seealso{}
## @end deftypefn
## Author: Jens Ahrensfeld <ahrensfeld@w2ess001vm>
## Created: 2018-12-05
function next = lfsr (size, poly, curr)
next = 2*xor(curr, poly);
endfunction
+64
View File
@@ -0,0 +1,64 @@
function y = manchester(x, type)
N = length(x);
mtype = 'ieee802.3';
if (nargin > 1)
mtype = type
end
t = -1;
v = -1;
if (strcmp(mtype, 'I') || strcmp(mtype, 'ieee802.3'))
v = 0;
t = 1;
end
if (strcmp(mtype, 'II') || strcmp(mtype, 'Thomas'))
v = 0;
t = 2;
end
if (strcmp(mtype, 'BP-M'))
v = 1;
t = 1;
end
if (strcmp(mtype, 'BP-S'))
v = 0;
t = 1;
end
if (t == 1)
s = 1;
y = [];
for n=1:N,
if x(n) == v
s = not(s);
y = [y s];
y = [y s];
else
s = not(s);
y = [y s];
s = not(s);
y = [y s];
end
end
end
if (t == 2)
s = 1;
y = [];
for n=1:N,
if x(n) == v
y = [y not(s)];
y = [y s];
else
y = [y s];
y = [y not(s)];
end
end
end
endfunction
+17
View File
@@ -0,0 +1,17 @@
% qam(n)
% Qam
%
function qamTbl=qamTable(n)
startIQ = 1.0/sqrt(2.0)
stepIQ = 2*startIQ/(sqrt(n)-1)
qamTbl = zeros(n,1);
s=1;
for I=-startIQ:stepIQ:startIQ,
for Q=-startIQ:stepIQ:startIQ,
qamTbl(s) = I + i*Q;
s = s + 1;
end;
end;