The following is a demonstration of ethernet Manchester data encoding, and the resulting spectrum after
filtering and modulation. It was done on MATLAB (TM The Math Works, Inc.)
First we build a random digital number sequence... 1000 data points long:info_rand=rand(1,1000); %1000 element random matrix
info_dig=find(info_rand>0.5); %makes it into a random binary value
info=zeros(1,1000); %make an array to show our random data
info(info_dig)=ones(size(info_dig)); %now put the random ones in
info(1:10)
ans =
1 1 1 0 0 1 1 1 0 0
Next we build up the Manchester encoding (we need a transition in the direction of the data value):
Now we will look at the spectrum of the modulated data:
Lets put a 20 Mhz cutoff filter -
Calculate the frequency versus time:
This says that our IF should have approximately a 40 to 50 Mhz filter width to accommodate our signal.
To get a modulation index of 2, we need to modulate the RF swing by 40 Mhz...
Calculate the frequency versus time:
Now we will look at the resulting spectrum:
This says that our IF should have approximately a 40 to 50 Mhz filter width to accommodate our signal.
To get a modulation index of .1, we need to modulate the RF swing by 2 Mhz...
Calculate the frequency versus time:
Now we will look at the resulting spectrum:
Demodulating this will be very difficult
pre=ones(size(info))-info; %complement the data as the level in the
% first half of the bit period must be the opposite of the data value
% to make for the wanted data transition
man=[pre ; info]; %intersperse the prestate with the data
manchester(:)=man; %make the 2 x 1000 array into a 1 x 2000 array
manchester(1:20)' %give the data in the first 10 cells x 2 halves
ans =
Columns 1 through 12
0 1 0 1 0 1 1 0 1 0 0 1
Columns 13 through 20
0 1 0 1 1 0 1 0
Now we build up a time plot: each cell is 100nS (at 10Mbit/sec), so each half cell is 50uS
mod_size=ones(50,1); %one tic per microsecond
manbig=mod_size*manchester'; %50 tics per half cell
manmod=manbig(:); %rearrange the square array into a linear array
plot(manmod(1:1000))
title('Manchester data output - first 10 points')
xlabel('Time in nanoseconds')
Note that the original data is encoded by the transitions at the x50nS points.
spectrum_raw=fft(manmod);
f=1/(length(spectrum_raw)*1e-9)*(1:length(spectrum_raw));
plot(f(2:10000),abs(spectrum_raw(2:10000)))
We have significant spectrum out past 100 Mhz - It looks like the raw data needs some filtering....
(Note: the 1 bin was omitted from the data - it is the DC component and dwarfs the others
[B,A]=cheby1(8,3,.04); %20Mhz 8th order filter
man_filt=filter(B,A,manmod); filter the raw data
plot(man_filt(1:1000)) %lets look at it
title('Manchester data output - first 10 points')
xlabel('Time in nanoseconds')
Recheck the resulting spectrum
spectrum_filt=fft(man_filt);
f=1/(length(spectrum_filt)*1e-9)*(1:length(spectrum_filt));
plot(f(2:10000),abs(spectrum_filt(2:10000)));xlabel('frequency in Hz')
To get a modulation index of 1, we need to modulate the RF swing by 20 Mhz...
We will have our "zero" level of 20 Mhz and our "one" level of 40 Mhz:
omega=2*pi/1000*(20*(ones(size(man_filt)))+20*man_filt);
Now we sum up to get the phase:
angle=cumsum(omega);
man_if=sin(angle);
plot(man_if(1:1000))
xlabel('time in nanoseconds')
This is what our IF should look like with a 30 Mhz center frequency and a 20 Mhz shift...
Now we will look at the resulting spectrum:
spectrum_if=fft(man_if);
f=1/(length(spectrum_if)*1e-9)*(1:length(spectrum_if));
plot(f(2:10000),abs(spectrum_if(2:10000)));xlabel('frequency in Hz')
As can be seen, the 20Mhz input bandwidth gets spread into + and - 25 Mhz sidebands about the 30 Mhz center frequency.
We will have our "zero" level of 20 Mhz and our "one" level of 60 Mhz:
omega=2*pi/1000*(30*(ones(size(man_filt)))+40*man_filt);
Now we sum up to get the phase:
angle=cumsum(omega);
man_if=sin(angle);
plot(man_if(1:1000))
xlabel('time in nanoseconds')
This is what our IF should look like with a 50 Mhz center frequency and a 40 Mhz shift...
spectrum_if=fft(man_if);
f=1/(length(spectrum_if)*1e-9)*(1:length(spectrum_if));
plot(f(2:10000),abs(spectrum_if(2:10000)));xlabel('frequency in Hz')
As can be seen, the 20Mhz input bandwidth gets spread into + and - 35 Mhz sidebands about the 50 hz center frequency.
We will have our "zero" level of 29 Mhz and our "one" level of 31 Mhz:
omega=2*pi/1000*(29*(ones(size(man_filt)))+2*man_filt);
Now we sum up to get the phase:
angle=cumsum(omega); man_if=sin(angle);
plot(man_if(1:1000))
xlabel('time in nanoseconds')
This is what our IF should look like with a 30 Mhz center frequency and a 2 Mhz shift...
spectrum_if=fft(man_if);
f=1/(length(spectrum_if)*1e-9)*(1:length(spectrum_if));
plot(f(2:10000),abs(spectrum_if(2:10000)));xlabel('frequency in Hz')
As can be seen, the 20Mhz input bandwidth stays about 20Mhz, but almost none of the power is in he information side bands, rather, most of it is in the carrier, and we still need a 20 Mhz wide IF filter...
Return to the Microwave Data Project page