Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Sponsor

NEW! TMS320C6474: 3x the performance. 1/3 the cost. Three 1 GHz cores on 1 chip.

Discussion Groups

Discussion Groups | Matlab DSP | Help in Fixed point toolbox

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Help in Fixed point toolbox - rajsekharbandaru - Feb 16 5:45:00 2005





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





(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Help in Fixed point toolbox - decious99 - Feb 16 22:18:00 2005



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





(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )