Reply by mnentwig October 16, 20142014-10-16
actually I've been wondering how exactly you've been measuring, could be
_two_ coax cables (I+Q baseband).
The "ears" in the noisefloor are artifacts from sample rate conversion, the
bump in the middle is a baseband filter. But I didn't find any obvious
phase noise or image component.	 

_____________________________		
Posted through www.DSPRelated.com
Reply by Peter Mairhofer October 16, 20142014-10-16
Hi Markus,

Thanks so much for your effort & sharing.

Indeed - it seems that the turn-on transient caused also the problems in
my equalizer (I also just used the pseudo inverse of shifted output
signals for a post distorter).

On 2014-10-15 9:52, mnentwig wrote:
> yes... > With equalization, the in-channel error drops to around -80 dBc. > > Spectrum: > https://drive.google.com/file/d/0B1gLUU8hXL7vMUZlTURGUl9nODg/view?usp=sharing > > Estimated system impulse response: > https://drive.google.com/file/d/0B1gLUU8hXL7vMmk1bUxqVUs2Z3M/view?usp=sharing > > My script: > https://drive.google.com/file/d/0B1gLUU8hXL7vcGR4eEpMZm5pYjA/view?usp=sharing > > The result is pretty good - coax cable performs as expected :-)
^^^^^^^^^^ You mean you transfer -86 dB signals through coax? Peter
Reply by Eric Jacobsen October 15, 20142014-10-15
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
Reply by mnentwig October 15, 20142014-10-15
yes...
With equalization, the in-channel error drops to around -80 dBc.

Spectrum:
https://drive.google.com/file/d/0B1gLUU8hXL7vMUZlTURGUl9nODg/view?usp=sharing

Estimated system impulse response: 
https://drive.google.com/file/d/0B1gLUU8hXL7vMmk1bUxqVUs2Z3M/view?usp=sharing

My script:
https://drive.google.com/file/d/0B1gLUU8hXL7vcGR4eEpMZm5pYjA/view?usp=sharing

The result is pretty good - coax cable performs as expected :-)
	 

_____________________________		
Posted through www.DSPRelated.com
Reply by mnentwig October 15, 20142014-10-15
Hi,

there seems to be a simple turn-on transient in the data. Remove it and I
get around -100 dB adjacent channel power. In-channel EVM looks like -43
dBc in the spectrum.

    sIn = load('xnbb.mat'); sIn = sIn.xnbb(:, 2); sIn = sIn(:).';
    sOut = load('xnrx.mat'); sOut = sOut.xnrx(:); sOut = sOut(:).';
    [coeff, sIn, deltaN] = fitSignal_120825(sOut, sIn);
    
    n = 1000;
    q = linspace(0, 1, n);
    sIn(1:n) = sIn(1:n) .* q;
    sOut(1:n) = sOut(1:n) .* q;
    sIn(end-n+1:end) = sIn(end-n+1:end) .* fliplr(q);
    sOut(end-n+1:end) = sOut(end-n+1:end) .* fliplr(q);
    sErr = sOut - sIn;
	 

_____________________________		
Posted through www.DSPRelated.com
Reply by October 15, 20142014-10-15
I didn't read all the posts so I'm sorry if this is redundant

1.Check that you do not have any overflows.
Scale everything down by 6 dB (1 bit) and see if that changes anything.
Often with random data there are subtle occasional overflows that can casue regrowth.

2.  Check the system at various points, i.e. at the Tx output instead of in the Rx.  See where the degredation first occurs.

Mark

Reply by Peter Mairhofer October 15, 20142014-10-15
Hi Markus,

Thanks so much.
Good catch that maybe the time alignment went wrong?

On 2014-10-15 0:13, mnentwig wrote:
> Hi Peter, > > if you post the input- and output IQ data somewhere? I can have a look > after work.
I placed a zip file with the complete demo at: https://dl.dropboxusercontent.com/u/9844683/simulink_demo.zip It contains the MATLAB and Simulink file for reference and the data files are: * xnbb.mat: the input signal (first column: time, second: I/Q data) * xnrx.mat: received data as "received" from the simulink model * rx.mat: output from fitSignal_120825
> Judging from the adjacent channel distortion (draw the line through the > channel) you should get better than -40. I suspect the equalization needs > to be improved but it could have other causes such as the sampling rates > wandering around. > > What I'd do is time-align and scale, then take the difference between the > IQ streams. Plot it in time domain (real/imag) and its spectrum. Try to > make some sense of the error after isolating it from the signal.
Hmm, frequency domain error pretty much looks like white noise to me. Time domain error too at the first glance. Autocorrelation gives also a white noise dirac at first sight but zooming in looks like a very noise modulated sinc shape ... Weird ... would speak for Zero-Order-Hold sinc distortion? But as I mentioned, when I just use pulses, I still do not get significantly more ... Best, Peter
Reply by mnentwig October 15, 20142014-10-15
Hi Peter,

if you post the input- and output IQ data somewhere? I can have a look
after work.
Judging from the adjacent channel distortion (draw the line through the
channel) you should get better than -40. I suspect the equalization needs
to be improved but it could have other causes such as the sampling rates
wandering around.

What I'd do is time-align and scale, then take the difference between the
IQ streams. Plot it in time domain (real/imag) and its spectrum. Try to
make some sense of the error after isolating it from the signal.
	 

_____________________________		
Posted through www.DSPRelated.com
Reply by dbd October 15, 20142014-10-15
On Tuesday, October 14, 2014 4:29:16 PM UTC-7, Peter Mairhofer wrote:
> Hi Eric, >
...
> > 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); >
...
> Peter
Peter "something like" is a little sketchy. How do you assure that the input signal is cyclic in the data duration passed to fitSignal_120825? How do you assure that there is no start-up transient included in the data block you analyze? Dale B. Dalrymple
Reply by Peter Mairhofer October 15, 20142014-10-15
Hi Eric,

On 2014-10-14 17:06, Eric Jacobsen wrote:
> On Tue, 14 Oct 2014 16:35:47 -0700, Peter Mairhofer <63832452@gmx.net> > wrote: >> On 2014-10-14 15:45, Eric Jacobsen wrote: >>> On Tue, 14 Oct 2014 14:41:17 -0700, Peter Mairhofer <63832452@gmx.net> >> [...] >>> Not sure how you're measuring SNR, >> >> 20*log10(norm(x-y)/norm(x)) > >> which is nothing but the definition of NMSE: >> >> 10*log10(mean(abs(x-y)^2)/mean(abs(x)^2)) > > I don't know where in the process you're taking x or y, and since > important details are coming out slowly this doesn't really tell me > that much since I don't know what happens in between.
I have an x "send" it through my model and "receive" y. *Then* in MATLAB I align y and perform the calculation above. I added a short MATLAB code in my previous response which should do a similar thing and shows similar results. From there it should be more clear.
>> And with this I agree (I'd expect -100dB or so), that's the reason for >> my question. > > No, the green trace in the plot you linked showed some > splattering/regrowth at around roughly 75dB.
I think this is noise which comes from imperfect integration in the simulator (it is solving the differential equations numerically). The fact that it is not regular may be caused by variable step size which give some frequency modulation of the error. In any case, if I reduce the maximum step size this "floor" decreases but NMSE stays the same. This can also be seen in the MATLAB equivalent code where this "splattering/regrowth" does not show up at all.
> If the blue trace was x > and the green trace was y in your NMSE definition,
which is the case
> then I would have > expected an in-band SNR somewhere around 75-80 dB.
I agree, me too, but that's not the case.
> If you're > including all of the out-of-band stuff in the SNR measurement that'll > get worse, naturally.
Yes, but not by 33-40 dB, right?
> SNR is essentially -NMSE, so there shouldn't be a huge disconnect > there.
I agree.
> [...] > The spectral regrowth and the spurs came from somewhere, and if > they're included in the NMSE measurement they'll affect the result. > > You should be able to look at the spectrum at various points in the > signal flow and see what's contributing to the regrowth/distortion.
See above - I think these are simulator artefacts. No regrowth/distortion with MATLAB code but same error (-41 dB) Peter