{"id":3759,"date":"2020-06-01T07:33:10","date_gmt":"2020-06-01T07:33:10","guid":{"rendered":"http:\/\/www.raymaps.com\/?p=3759"},"modified":"2022-06-03T12:21:07","modified_gmt":"2022-06-03T12:21:07","slug":"modeling-phase-and-frequency-synchronization-error","status":"publish","type":"post","link":"https:\/\/www.raymaps.com\/index.php\/modeling-phase-and-frequency-synchronization-error\/","title":{"rendered":"Modeling Phase and Frequency Synchronization Error"},"content":{"rendered":"\n<p>Carrier phase or frequency synchronization is a common problem in wireless communication systems. These two problems are interrelated as instantaneous frequency is just the rate of change of phase. The problem of carrier frequency offset might appear due to one of two reasons. Either the oscillators at the transmitter and receiver are not aligned in the frequency domain or there is a Doppler shift introduced by the channel (remember that a moving object in the wireless environment introduces a Doppler shift). In the case of the former the frequency misalignment is given in parts per million (ppm). A typical value for commercially available oscillators is \u00b120 ppm. Assuming that there is maximum frequency error at both the transmitter and receiver the error increases to \u00b140 ppm. At 1GHz this translates to 40*1,000,000,000\/1,000,000 = 40kHz.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>MATLAB code for calculating Bit Error Rate\n(BER) in presence of phase and frequency error is given below. <\/p>\n\n\n\n<pre lang=\"MATLAB\">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% BSPK MODULATION WITH CARRIER\n%    PHASE\/FREQUENCY ERROR\n%       www.raymaps.com\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\nclear all\nclose all\n\nl=5e3;              % Number of BPSK symbols\nN=40;               % Samples per symbol\nfc=1e9;             % Carrier frequency\nfs=10*fc;           % Sampling frequency\nts=1\/fs;            % Sampling interval\nt=0:ts:ts*(N*l-1);  % Total time\nEb=N;               % Energy per bit\nEbNodB=10;          % Energy per bit to noise PSD in dB\ndp=0;               % Phase offset\ndf=10e3;            % Frequency offset\n\n% CARRIER GENERATION\ntx_carrier=(sqrt(2))*cos(2*pi*fc*t);\nrx_carrier=(sqrt(2))*cos(2*pi*(fc+df)*t+dp);\n\n% SIGNAL GENERATION\ntx_symbol=2*(round(rand(1,l))-0.5);\noversampled_sym_matrix=ones(N,1)*tx_symbol;\noversampled_sym_vector=reshape(oversampled_sym_matrix,1,N*l);\ntx_signal=oversampled_sym_vector.*tx_carrier;\n\n% NOISE ADDITION\nEbNo=10^(EbNodB\/10);\ncalibrated_noise=sqrt(Eb\/(2*EbNo))*randn(1,N*l);\nrx_signal=tx_signal+calibrated_noise;\n\n% SIGNAL RECOVERY\ndown_converted_signal=rx_signal.*rx_carrier;\nfiltered_signal=ones(1,N)*reshape(down_converted_signal,N,l);\nrx_symbol=sign(filtered_signal);\n\n% BIT ERROR RATE CALCULATION\nber=(l-sum(tx_symbol==rx_symbol))\/l\n<\/pre>\n\n\n\n<p>Note: <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>We have used passband simulation unlike our previous posts since the above concepts are easier to explain this way. But the down side is that simulation takes longer, since we sample at ten times the carrier frequency to get accurate results. <\/li><li>Please note that a constant frequency error increases the phase error  and the results are quite adverse even for a small frequency shift. The cumulative phase shift depends upon how long a symbol sequence we are simulating (since phase is just the integral of the frequency)  .<\/li><li>A drift in the local oscillator can be on either side, higher or lower, or even cyclic. So, it is possible that cumulative effect is very small. <\/li><li>In practical systems phase of the carrier is estimated at the receiver by a Phase Locked Loop (PLL). This is something we will discuss in a future post. <\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Carrier phase or frequency synchronization is a common problem in wireless communication systems. These two problems are interrelated as instantaneous frequency is just the rate of change of phase. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[34,37,70,220,221],"class_list":["post-3759","post","type-post","status-publish","format-standard","hentry","category-berp","tag-ber","tag-bpsk","tag-frequency","tag-phase","tag-synchronization"],"_links":{"self":[{"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/posts\/3759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/comments?post=3759"}],"version-history":[{"count":6,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/posts\/3759\/revisions"}],"predecessor-version":[{"id":4275,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/posts\/3759\/revisions\/4275"}],"wp:attachment":[{"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/media?parent=3759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/categories?post=3759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.raymaps.com\/index.php\/wp-json\/wp\/v2\/tags?post=3759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}