how to implement a sum of square pulses encoding a data message

5 visualizaciones (últimos 30 días)
musedpony el 18 de Jun. de 2017
Comentada: musedpony el 22 de Jun. de 2017
I want to create a function m(t) such that
m(t) = a_0*p(t) + a_1*p(t-T) + a_2*p(t-2T) ... + a_n*p(t-2N)
ie, m(t) = sum(a_kp(t-kT))
where
-T defined by user
-a_k coefficients in binary, defined by user
The plot of m(t) against time should therefore be pulses of width T representing a bitstream corresponding to what was entered by the user.
Right now I'm only concerned with p(t) as rectangular pulse.
I've tried several ways of implementing this and I always get stuck at trying to define the pulse train successfully. Is there not a simple way of shifting rectangularPulse(a,b,t) and adding it to itself? I'm not very familiar with Matlab and I think all the vector stuff is messing me up.
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Jayaram Theegala el 20 de Jun. de 2017
You can use functions from Symbolic Math Toolbox for achieving what you are trying to do. The "rectangularPulse" pulse function can help you create the "p(t)" function.
You may find the following MATLAB script helpful to get started:
syms t % create the time variable
N = 10; % number of time points
T = 1; % Time period for the pulse
a = rand(1,N); % example values
m = 0; % the function which you are trying to create
for k = 1:N
m = m + a(k)*rectangularPulse(-k*T,-(k-1)*T,t);
end
fplot(m,[-11 1])
I hope this helps.
1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
musedpony el 22 de Jun. de 2017
Thank – yes, that worked! I used this:
syms t % create the time variable
%user input time duratio no pulses p(t) x = inputdlg('Enter the time duration for each pulse'); T = str2double(x{:});
%define binary input as coefficients for message of shifted pulses binaryMess = inputdlg('Enter an 8-bit space-separated binary sequence for transmission:',... 'Sample', [1 50]); a = str2num(binaryMess{:}); N = length(a);
m = 0; % define the function m(t)
%implement m(t) as a sum of shifted rectangular pulses with coefficients a, %duration T for k = 1:N m = m + a(k)*rectangularPulse((k-1)*T,k*T,t); end
%plot message fplot(m,[0 N*T+T])

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by