DSPRelated.com
Forums

conv and deconv functions

Started by brijrajv June 16, 2004
Hi all,

I am having problems using the combination of conv and deconv
function.
I have a large number of random processes which I convolve with its
fliped version, then I deconvolve the result obtained from
convolution with the fliped version of random process, the procedure
works for all but some specific cases.
The code below should help you understand the problem. %%%%%%% Code starts %%%%%%%%%%%%%%
t_bit-6;
r_bit=1/t_bit;
fc1= 2*r_bit;
n=4;
input_stream1=[0 1 0 1];

i=1;
j=1;

% Value of m depends on the order of the modulation
for m=1:n:(length(input_stream1)-n+1)

k=1;
% Extracting number of bits to be represented in a symbol
bit_stream1=input_stream1(1,m:(m+n-1));
dec1=bin_to_dec(bit_stream1);
% Calculating phase angle depending on the decimal equivalent
theta1(j)1* ((2*pi)/M);

for t=(m-1)*t_bit*(1/n):1/(20*fc1):((m+(n-1))*t_bit*(1/n))-(1/
(20*fc1))
% Formulae to find of the M-PSK signal
s1(k)=amp1*cos(2*pi*fc1*t + theta1(j));
y(i)=t;
i=i+1;
k=k+1;
end

% Convolution
fliped_s1=fliplr(s1);
r_s1=conv(s1,fliped_s1);

% Deconvolution
s_1onv(r_s1,fliped_s1);
diff = s1 - s_1
end

%%%%%%%%% Code ends%%%%%%%%%%%%%%%%%

The diff in this case should be zero but it is not, this problem
occurs for the input_stream1= 0 1 0 1 and 1 1 0 1 for all other 4 bit
combinations the diff is rightly zero. I am trying to find out as to
why am I not getting the diff as 0 for all cases.

Please can someone help me find out the problem.

Thanking you all in anticipation

Brijraj



Hi,
 
    The deconv function is slightly trick. I will give you a hint and you can actually try and see if it helps.
 
    Deconv is implemented by long division in Matlab. For this a filter is implemented with the arguments being fed as the coefficients of the numerator and denominator with the data being 1. Thus, the deconv is actually an impulse output of a filter with the arguments as coefficients of numerator and denominator. Now if the first coefficient is zero, it may not be accepted and maybe the function will alter the polynomial to overcome the situation resulting in an undesired output. This might explain for the [0 1 0 1] part and maybe the second input of [1 1 0 1] may have something to do with consistency of poles and zeros of the filter. Moreover, deconv is sensitive to noise and gives undesirable outputs in presence of noise.
 
    An alternate solution could be by taking fft and ifft. Since convolution will be multiplication in frequency domain, things maybe a lot easier then.
 
    In case you find a solution, then do share it on the group.
 
    Cheers,
 
-Snehamoy Banerjee
----- Original Message -----
From: brijrajv
To: m...@yahoogroups.com
Sent: Thursday, June 17, 2004 1:26 AM
Subject: [matlab] conv and deconv functions

Hi all,

I am having problems using the combination of conv and deconv
function.
I have a large number of random processes which I convolve with its
fliped version, then I deconvolve the result obtained from
convolution with the fliped version of random process, the procedure
works for all but some specific cases.
The code below should help you understand the problem.%%%%%%% Code starts %%%%%%%%%%%%%%
t_bit-6;
r_bit=1/t_bit;
fc1= 2*r_bit;
n=4;
input_stream1=[0 1 0 1];

i=1;
j=1;

% Value of m depends on the order of the modulation
for m=1:n:(length(input_stream1)-n+1)
   
    k=1;
    % Extracting number of bits to be represented in a symbol
    bit_stream1=input_stream1(1,m:(m+n-1));
    dec1=bin_to_dec(bit_stream1);
    % Calculating phase angle depending on the decimal equivalent
    theta1(j)1* ((2*pi)/M);

    for t=(m-1)*t_bit*(1/n):1/(20*fc1):((m+(n-1))*t_bit*(1/n))-(1/
(20*fc1))
        % Formulae to find of the M-PSK signal
        s1(k)=amp1*cos(2*pi*fc1*t + theta1(j));
        y(i)=t;
        i=i+1;
        k=k+1;
    end
   
    % Convolution
    fliped_s1=fliplr(s1);
    r_s1=conv(s1,fliped_s1);

    % Deconvolution
    s_1onv(r_s1,fliped_s1);
    diff = s1 - s_1
end

%%%%%%%%% Code ends%%%%%%%%%%%%%%%%%

The diff in this case should be zero but it is not, this problem
occurs for the input_stream1= 0 1 0 1 and 1 1 0 1 for all other 4 bit
combinations the diff is rightly zero. I am trying to find out as to
why am I not getting the diff as 0 for all cases.

Please can someone help me find out the problem.

Thanking you all in anticipation

Brijraj



_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3