Technical discussion about Matlab and issues related to Digital Signal Processing.
|
hi, I have two floating point arrays say Signal1 = sin(2 * pi * 10 * (.1:.1:10)); Signal2 = sin(2 * pi * 5 * (.1:.1:10)); Now I want to covolve those two signals after fixed point conversion So FixedSignal1 = fi(Signal1,1,16); FixedSignal2 = fi(Signal2,1,16); Output = conv(FixedSignal1,FixedSignal2); The above statement is giving an error ?? Error using ==> conv A and B must be vectors. Can anyone help me in this regard?? Raj |
|
The conv function is not defined in the fix point toolbox, Typically its easier to round your floating point to the nearest lsb (or in this case they are doubles from how you defined them) So for example, if you have 16 bit number, you have some precision associated with it, say 2^-4, so it would be in the form 12.4 format. Which can be either signed or unsigned. So you could do the following However, you signal you defined is all zero, since everything is a multiple pi, so your signal will be zero. lsb = 2^-4; Signal1 = round( Signal1 / lsb ) * lsb; % round to the nearest lsb Signal2 = round( Signal2 / lsb ) * lsb; A = conv( Signal1 , Signal2 ); then find out what your lsb would be as a result of your operation. fix point it, by A_int = round( A / A_lsb ); % 2's complement it idx = find( A_int < 0 ); A_int( idx ) = A_int( idx ) + 2^16 % do whatever you want to it, I outputed it to hex. A_hex = dec2hex( A_int , 4 ); I found a lot of times the fix point tool box causes more headache than help for fix point operations. It is easier to do things in doubles and convert the number to intergers after the math is done, ( this way you don't have these ridiculus sized integer values during calculations that slow down processing time ). hope this helps. --- In , "rajsekharbandaru" <rajsekharbandaru@y...> wrote: > hi, > > I have two floating point arrays say > > Signal1 = sin(2 * pi * 10 * (.1:.1:10)); > Signal2 = sin(2 * pi * 5 * (.1:.1:10)); > > Now I want to covolve those two signals after fixed point conversion > > So FixedSignal1 = fi(Signal1,1,16); > FixedSignal2 = fi(Signal2,1,16); > Output = conv(FixedSignal1,FixedSignal2); > The above statement is giving an error > > ?? Error using ==> conv > A and B must be vectors. > > Can anyone help me in this regard?? > > Raj |