Reply by amlangford December 21, 20112011-12-21
Hi all,

Thank you all for your suggestions and contributions to this thread. 

Regarding the 'original' question about discontinuities in the filter time
series output, the cause turned out to be as a result of truncation of the
impulse response. 

As the impulse response length is decreased (by reducing N), errors appear
in the filter output every T samples

N = 256;
T = 64;
alpha = 0.5;
hd  = fdesign.pulseshaping(T,'Square Root Raised Cosine','N,Beta',N,
alpha);
h = design(hd); 
figure(1);
subplot(2,1,1)
plot(-N/2:N/2,h.Numerator)
subplot(2,1,2)
y = filter(h.Numerator,1,upsample((2 * randi([0 1],1,2000))-1,T));
plot(y(N/2:100*T))

Reply by amlangford December 21, 20112011-12-21
Hi all,

Thank you all for your suggestions and contributions to this thread. 

Regarding the 'original' question about discontinuities in the filter time
series output, the cause turned out to be as a result of truncation of the
impulse response. 

As the impulse response length is decreased (by reducing N), errors appear
in the filter output every T samples

N = 256;
T = 64;
alpha = 0.5;
hd  = fdesign.pulseshaping(T,'Square Root Raised Cosine','N,Beta',N,
alpha);
h = design(hd); 
figure(1);
subplot(2,1,1)
plot(-N/2:N/2,h.Numerator)
subplot(2,1,2)
y = filter(h.Numerator,1,upsample((2 * randi([0 1],1,2000))-1,T));
plot(y(N/2:100*T))

Reply by mnentwig December 20, 20112011-12-20
argh... I meant the other way round. It's late...
blue = "my" weighted LS design
Black, "firls" from Kadhiem's script

Reply by mnentwig December 20, 20112011-12-20
an interesting comparison.
Both are (or "should be") optimal, as they are the result of a LMS
algorithm. 
The difference is in the weighting of the error that is minimized, how to
trade off between different frequencies.

The "firls" design minimizes the error over the whole bandwidth. An in-band
vector error due to ripple is considered as "important" as out-of-band
leakage, and the sum of all errors over the whole bandwidth is minimized. 

I'm putting a bit more emphasis on stopband rejection, but the numbers are
quite arbitrary.
The radio standard will demand a "spectral emission mask", and most likely
the point where the stopband start (let's say, bin 8000 in the following
pictures) will become the critical requirement that determines your filter
size, when a given error vector magnitude may not be exceeded.

stopband: blue = firls; black = "my" weighted LS design
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_out1.png

passband ripple
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_out2.png
Reply by kaz December 20, 20112011-12-20
Here is example of using firls for even filter with two equal peaks (even
symmetry).set dc gain to 1, transition band as per suitable formula, stop
band at zero.


B = .15;  %rolloff
Rs = .5;  %symbols upsampled by 2
T = 1/Rs;
Fn = Rs/2;

%transition band
f = linspace((1-B)/4,(1+B)/4,256); 
for i = 1:256
   A(i) = sqrt(.5 + .5*sin(pi/(2*Fn)*(Fn - f(i))/B)); 
end

%stopband
A(224:end) = 0;  

h = firls(79,[0 f*2 1],[1 A 0],[1 ones(1,256/2-1)*1 1]);

kadhiem

Reply by mnentwig December 20, 20112011-12-20
typo in the frequency response URL:
frequency response (blue), error vector magnitude (red)
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_RRC2.png

Reply by mnentwig December 20, 20112011-12-20
for comparison, here is an 80-tap FIR that was numerically optimized for
-40 dBc peak -in-band error and some reasonable stopband rejection. One
should have a look at the requirements for both, then reconsider the
length.

frequency response (blue), error vector magnitude (red)
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_RRC1.png

impulse response:
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_RRC1.png
http://www.dsprelated.com/blogimages/MarkusNentwig/comp.dsp/111220_ir.dat


Reply by kaz December 20, 20112011-12-20
Here is example 80 taps root raised cosine. There are several equations
that give slight differences.

Moreover you may want even taps with two equal centre taps. That needs a
different approach(use firls setting Amp as required).

B= .15;   %rolloff
Fs = 1;
Rs = Fs/2;     
Ts = 1/Rs;

for i = -39:40
   h(i+40) = (sin(pi*i/Ts*(1-B)) +
4*B*i/Ts*cos(pi*i/Ts*(1+B)))/(pi*i/Ts*(1-(4*B*i/Ts)^2));
end

h(40) = 1;

kadhiem



Reply by kaz December 20, 20112011-12-20
>On Mon, 19 Dec 2011 11:46:07 -0600, "amlangford" ><amlangford31@n_o_s_p_a_m.hotmail.com> wrote: > >>Hi all, >> >>Thanks for the comments...apologies for the late feedback.. >> >>To re-iterate, the discontinuities Im seeing are in the output of my >>filter. >> >>I should add another "key" piece of information: The Matlab raised
cosine
>>design methods all return an even ordered filter, and thus odd number of >>taps. The filter structure Im loading the coefficients into is already >>implemented in an FPGA, and expects an even number of taps. >> >>Thus, I have the problem - How do I extract an even number of taps for
my
>>filter implementation from an odd number of designed coefficients. > >Just add a coefficient at one of the ends set zero so that there's an >even number of taps. In other words, load your full odd-tapped >coefficient set and set the remaining coefficient (at whichever end) >to zero.
While true, adding a zero(or zeros) at one end gives equivalent output possibly with output delay difference, but any filter can be visualised as having zero(s) at one or other end. I think if your fpga structure has even number of coeffs then it is meant to have it for some good reason e.g. to obtain two equivalent polyphases if read one opposite the other. Adding a zero in this case will not help the purpose. You will then need to design your own even filter from cosine formula. Kadhiem
Reply by Jerry Avins December 19, 20112011-12-19
On 12/19/2011 3:18 PM, Eric Jacobsen wrote:

   ...

> Just add a coefficient at one of the ends set zero so that there's an > even number of taps. In other words, load your full odd-tapped > coefficient set and set the remaining coefficient (at whichever end) > to zero.
The "far" end gives lower latency. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;