axristos86
Newbie level 2
Hello!I can't find how to programm equations like this
E(t)= Σbn*g(t-nTs)
in Matlab
Specifically I want to generate a gaussian pulse sequence modulated by a bit sequence.The mathematical expression is
E(t)=c(1)exp[-(t-Tb/2)^2/2To^2] + c(2)exp[-(t-3Tb/2)^2/2To2]+…. +c(i)exp[-(t-(i-1/2)Tb)^2/2To^2]
c is the bit sequence.
i have written a code for the three terms of the equation which works and shows the pulses with amplitude 0 or 1 in time.
that's the code
d=randint(127,1);
c(1)=xor(1,d(1));
for i=2:127
c(i)=xor(d(i),c(i-1)); % dpsk mod data
end
Tb=100; %ps
To=0.158*Tb;
E=c(1)*exp(-(t-(Tb/2)).^2/(2*To*To)) + c(2)*exp(-(t-3*(Tb/2)).^2/(2*To*To)) +c(3)*exp(-(t-5*(Tb/2)).^2/(2*To*To));
t=0:500;
plot(t,E);
how can i programm it for all the 127 pulses of course without writting them one by one?I have tried some loops but it wouldn't work because i can't give simultaneously values to i and t.
Thank you!
E(t)= Σbn*g(t-nTs)
in Matlab
Specifically I want to generate a gaussian pulse sequence modulated by a bit sequence.The mathematical expression is
E(t)=c(1)exp[-(t-Tb/2)^2/2To^2] + c(2)exp[-(t-3Tb/2)^2/2To2]+…. +c(i)exp[-(t-(i-1/2)Tb)^2/2To^2]
c is the bit sequence.
i have written a code for the three terms of the equation which works and shows the pulses with amplitude 0 or 1 in time.
that's the code
d=randint(127,1);
c(1)=xor(1,d(1));
for i=2:127
c(i)=xor(d(i),c(i-1)); % dpsk mod data
end
Tb=100; %ps
To=0.158*Tb;
E=c(1)*exp(-(t-(Tb/2)).^2/(2*To*To)) + c(2)*exp(-(t-3*(Tb/2)).^2/(2*To*To)) +c(3)*exp(-(t-5*(Tb/2)).^2/(2*To*To));
t=0:500;
plot(t,E);
how can i programm it for all the 127 pulses of course without writting them one by one?I have tried some loops but it wouldn't work because i can't give simultaneously values to i and t.
Thank you!