On Tue, 14 Oct 2014 20:31:42 -0700, Peter Mairhofer <63832452@gmx.net>
wrote:
>Hi Eric,
>
>I just found one potential issue: The zero order hold introduces sinc
>distortion. But that's not "the" problem (see below).
>
>Besides that, what is the easiest (even if unphysical) way to get rid of
>the sinc distortion?
>
>I tried different things, among "pre emphasis". Suppose "xd" is the
>original digital sequence. Then the spectrum should be shaped based on
>the first sinc lobe. I tried this:
>
>Fsinc = sinc(linspace(-1, 1, length(xd))).';
>% don't correct anything for near-zero values
>Fsinc(1:1000) = 1;
>Fsinc(end:-1:end-1000+1) = 1;
>% DFT spectrum is mirrored
>Fsinc = fftshift(Fsinc);
>% this is the actual signal to be transmitted
>tx = ifft(fft(xd)./Fsinc);
>
>However, the problem even gets worse. Do I do anything wrong here?
>
>(I know in practice a time domain filter would be required. All I want
>for now is to eliminate all effects from that).
>
>On 2014-10-14 16:52, Eric Jacobsen wrote:
>> On Tue, 14 Oct 2014 16:29:16 -0700, Peter Mairhofer <63832452@gmx.net>
>> wrote:
>>> On 2014-10-14 15:40, Eric Jacobsen wrote:
>>>> On Tue, 14 Oct 2014 14:41:17 -0700, Peter Mairhofer <63832452@gmx.net>
>>>> [...]
>>>
>>> Oh, they should. As mentioned in the subject this is a Simulink model
>>> maybe I should have emphasized that again.
>>
>> Many of us don't have or use simulink, so don't assume people know
>> what's in simulink blocks.
>
>But this should not matter too much. It is one of the simplest models
>you can come up with. Actually, you can do a similar thing in 30 lines
>of MATLAB code:
>
>% oversampling ratio
>SimFactor = 100;
>
>% this is the original x[n]
>% fs=100 MHz, BW=20 MHz, complex
>xd = xnbb(:,2);
>
>% simulate zero order hold
>xch0 = repmat(xd.', SimFactor, 1);
>xch0 = xch0(:);
>
>% DAC reconstruction filter for each I and Q branch
>% corresponds to fs/4=25 MHz in CT
>[numd_tx,dend_tx] = butter(5, 0.5/SimFactor);
>xnct_i = filter(numd_tx, dend_tx, real(xch0));
>xnct_q = filter(numd_tx, dend_tx, imag(xch0));
>
>% do I/Q upconversion
>t = (0:1/fs/SimFactor:(length(xnct_q)-1)/fs/SimFactor)';
>x_rf = cos(2*pi*fc*t) .* xnct_i - sin(2*pi*fc*t) .* xnct_q;
>
>% do IQ downconversion again
>xnct_down_i = x_rf .* cos(2*pi*fc*t);
>xnct_down_q = x_rf .* -sin(2*pi*fc*t);
>
>% image rejection filter (reject image at 1.2 GHz)
>% corresponds to fs=100MHz in CT
>[numd_rx,dend_rx] = butter(5, 2/SimFactor);
>xnct_down_bb_i = filter(numd_rx, dend_rx, xnct_down_i);
>xnct_down_bb_q = filter(numd_rx, dend_rx, xnct_down_q);
>
>% ideal ADC
>rx_i = downsample(xnct_down_bb_i, SimFactor);
>rx_q = downsample(xnct_down_bb_q, SimFactor);
>
>% combine signal in digital domain
>rx = 2*(rx_i +1i*rx_q);
>
>% time-align signal
>[coeff, rx] = fitSignal_120825(xnbb(:,2), rx);
>rx = rx(:);
>
>% show results
>NMSE = 20*log10(norm(xd-rx)/norm(xd))
>
>plot(20*log10(abs([ fftshift(fft(xd)) , fftshift(fft(rx)) ])));
>linspace(-fs/2, fs/2, length(xd));
>legend('TX', sprintf('RX: %0.02f dB', NMSE));
>
>It is certainly not equivalent because I have a fixed stepsize and
>bilinear transform. But the results are similar: -41.30 dB.
>
>I plot the the FFT (instead of PSD): http://snag.gy/R0jL1.jpg
>
>The weird high frequency lobes are still in the PSD plot but don't show
>up in the FFT.
>
>Regarding sinc distortion: When I remove zero order hold and just use
>pulses (simulated with "upsample") it does not get significantly better:
>-43.52 dB.
>
>>> No maxstep setting of the continuous-time solver (i.e., the Simulink
>>> simulation setting). I just use "ode45", by the way.
>>
>> No idea of the significance of ode45.
>
>Since the problems are the same I suspect a general misconception which
>might be evaluated from the above code too.
>
>>>>> This plot shows the PSD: http://snag.gy/oPHBV.jpg. It looks "perfect"
>>>>> although the noise floor is not perfect but can probably decreases by
>>>>> decreasing maxstep further (in this plot, maxstep=Ts/100).
>>>>
>>>> I'm guessing by the shape of the spectrum that this is a multicarrier
>>>> system?
>>>
>>> No. It's just something like
>>>
>>> x = randn(N,1) + 1i*randn(N,1);
>>> X = fft(x);
>>> X([N*bw+1:N-N*bw-1) = 0; % just ideally bandlimit x to 20 MHz
>>> % (bw is sth. like bw=100MHz/20MHz)
>>> x = ifft(X);
>>
>> Again, the block diagram doesn't show the FFTs and the bandlimiting,
>> which is a crucial point in understanding what you're doing.
>
>It is not part of the system. I just have a signal with these properties
>and is the input signal to the system.
The signal came from somewhere, and it can be difficult to understand
output effects if one doesn't fully understand how the signal was
generated.
>I have the signal. I don't even use the code above, it was shown as
>"pseudocode" to understand what it looks like.
How the signal is generated can be critical to understanding things
like this. Markus seems to have sorted out that a startup transient
is affecting things.
>> You've essentially made a multicarrier system. This is why the
>> spectrum looks like it does.
>
>No, I create a random signal.
>But of course you can feel free to interpret it as a discrete-time
>representation of a multicarrier signal where each carrier is
>arbitrarily I/Q modulated ...
>
>> It also means that the fft and ifft contribute to distortion in your
>> system, although I'd expect the effects to be small if they're both
>> floating point.
>
>Why? There is no FFT/IFFT involved here.
>Again, I am not doing OFDM et.al. and do not calulate my error based on
>some modulated symbols.
>
>It is nothing more but an arbitrary, bandlimited x[n], converted to x(t)
>and mixed to RF and back.
>
>>> [...]
>>> I do not have any noise sources.
>>> Of course the data is generated from a random source but once it is, it
>>> is the deterministic input signal.
>>
>> The randonmess of the data accounts for why the spectrum is not flat.
>
>Of course, it should not be flat. It should just be bandlimited.
>
>Maybe the PSD is not the perfect plot to show. Therefore I changed it to
>FFT plot.
>
>> Unless every in-band bin in the fft/ifft output are identical and you
>> use a flat-top window, you won't see a flat spectrum.
>
>which I don't want ;-)
>I want the green and blue curve to match :-)
>
>
>Thanks,
>Peter
>
>
>
Eric Jacobsen
Anchor Hill Communications
http://www.anchorhill.com