# What are the advantages and disadvantages of PN sequence over Walsh code

I would like to ask what are the disadvantages and advantages of PN sequence over Walsh code? and also Gold code over Walsh code.

I have checked online, but I didn't get clear explanation for that.

Thank you

A Pseudo-random noise (PRN) sequence ia a closer approximation to white random noise in that its energy is spread equally over the occupied frequency band (The energy is spread as a Sinc function if reconstructed with pulses just because of the pulse shape but the underlying code as a stream of impulses has a more uniform distribution), and its auto-correlation function approximates a single impulse; providing a strong correlation when the sequence is aligned with a copy of itself in time and very low correlation when there is any offset between the sequence and a copy of itself. This property makes it ideal for time alignment such as used in acquisition to find the start of a packet, or in RADAR and sounding applications to resolve a time delay with high precision. (This post details such an example with a PRN sequence: Autocorrelation to diagnose faults ) Also due to it filling an occupied frequency band evenly, PRN sequences are also ideal for training patterns to equalize a channel since the equalizer can resolve solutions only at frequencies where a signal is present.

Walsh Codes in contrast are not spread equally over frequency (as is clear if you consider the sequence of all 1's is a Walsh Code), but are completely orthogonal when time aligned. Given Walsh Codes are always an even number of digits, when you multiply one code to another in the same set and sum the digits, it will always add to 0. PRN codes generated with linear feedback shift registers (LFSR's) are always an odd number of digits, so are not able to add to complete 0 (be completely orthogonal) and further different codes can have higher cross correlations to each other. Walsh Codes are ideal for allocating users or resources in orthogonal code space when you have tight control of the time alignment of each user or resource (such as broadcasting to multiple users from a single transmitter). This orthogonality property is disrupted when the Walsh Codes have a time delay between them. This post demonstrates the channel or resource allocation and also shows the similarity to the DFT which is also simply another set of orthogonal codes: How CDMA receiver extract it's corresponding data from the receiving modulated & superposition-ed signal?

Gold Codes are generated by adding two LFSR outputs together, each generated with a separate polynomial. The advantage of this is we get many more usable codes of a given order, and the disadvantage is higher cross-correlation and sidelobes of the auto-correlation. This is what is used to generate the codes for GPS satellites and I explain Gold Codes in more detail specific to the GPS implementation at this link:

GPS Coarse Acquisition PRN Codes

• Thank you very much for that great explanation, I have some points I couldnt understand. 1- do you mean by the time alignment similar to the delay caused by channel? 2- you said "PRN sequences are also ideal for training patterns to equalize a channel": could you please provide any documents explaining channel estimation& equalization in PRN and/or Walsh code? does the pilot training are transmitted separately or superimposed as a user then transmit it with users? 3- so the cross correlation of PRN is higher than Walsh code, right? and that's disadvantage of PRN over Walsh code. thanks again – Fatima_Ali Jan 30 '20 at 13:46
• Cross correlation is higher but PRN sequences can be selected with very low cross-correlations to the point where that distinction is mute. If you have an application where you can assure time alignment (compare transmitting to all users from the same transmitter (rather than users each transmitting their own assigned Walsh Codes from different locations- they will be received with delay offsets to each other). – Dan Boschen Jan 30 '20 at 13:57
• I post an example of how channel equalization can be done here: dsp.stackexchange.com/questions/31318/… And I would not recommend using a Walsh Code as a training sequence since it does not weigh all the frequencies in the channel equally (in contrast to a PRN sequence). The rest of your questions in the comment do not have a one sentence answer, I recommend that you generate Walsh and PRN sequences yourself and observe the auto- and cross-correlations and try out equalization techniques to see how that applies. – Dan Boschen Jan 30 '20 at 13:58
• I got it. Regarding the equalization, itis OK. I mean the channel estimation in DSSS, in general, with multi-path channel, Should the pilot be sent similar to OFDM? I mean separately from data users. Or it can be transmitted as a user\? – Fatima_Ali Jan 30 '20 at 14:06
• One aspect of DSSS is its resilience to multipath and in particular frequency selective fading so how I am not sure how much equalization you would really need to do and how you do it is very dependent on the application, delay spread of the channel etc. One common approach to optimize the recelved signal energy is the RAKE receiver, and the channel estimates are what would coherently combine the largest correlations coming out of the RAKE --which you can determine from the spread user data themselves. – Dan Boschen Jan 30 '20 at 15:35