# Signal reconstruction

Discussion in 'Programmer's Corner' started by lamerooze, Apr 3, 2008.

1. ### lamerooze Thread Starter New Member

Mar 13, 2008
4
0
I am currently working on a MATLAB program for my research and have run into a wall, despite me looking up quite a number of resources.

Does anybody here know how to reconstruct a signal from an analytic signal?

Given that an analytic signal is made up of the real signal and the hilbert transform of the real signal, where

a(t) = sr(t) + i[sh(t)]

sr(t) = real signal
sh(t) = hilbert transform of the real signal

If you had an analytic signal, how would you decompose this and obtain sr(t) on MATLAB?

The problem with my current approach is that I only obtain sr(t) in the positive time-domain, because all negative frequencies have been stripped due to the effect of the Hilbert transform. I wish to obtain sr(t) which is in both the positive and negative time-domain. How do I circumvent/solve this issue?

EDIT: Any reference to external resources would be a great help thank you!

Nov 17, 2003
6,960
145

Dave

3. ### lamerooze Thread Starter New Member

Mar 13, 2008
4
0
Sure, below is the essence of the code of my rough program - here, I am trying to create a new sound file such that I can vary envelope contributions from two different source files while maintaining the fine structure of one source file.

An example: I have a piano and a flute source file. I create a new sound sample that contains 50% envelope contribution from piano, and 50% from flute, while preserving the fine structure of the piano.

h1a = hilbert(orig1); %orig1 is source file 1
h2a = hilbert(orig2); %orig2 is source file 2

% mag_e1 = magnitude of analytic signal 1

mag_e1a = abs(h1a);
mag_e2a = abs(h2a);

% The fine structure is denoted by arctan(s(t)/sh(t)).

% fs_e1a = fine structure of signal 1

fs_e1a = atan((imag(hilbert(orig1))) ./ orig1));

% changing envelope and fine structure contributions (env1 = %envelope contribution from piano, env2 = %envelope contribution from flute), and obtaining the new signal
e1_fs2 = (((env1/100) .* mag_e1a + (((env2)/100) .* mag_e2a)) .* cos(fs_e1a));

% normalize and save
env1_fts2 = e1_fs2./max(abs(e1_fs2)));
env2_fts1 = e2_fs1./max(abs(e2_fs1)));

Now if I were to try to recover my original piano sound by making env1 = 100 and env2 = 0, I cannot do this, because my new sound only contains positive frequency components, while the negative frequency components have been removed. I am wondering how to solve this.

Edited: Have attached an image for visualization purposes. As you can see, the top waveform is of the original file. When I run this program and try to recover my original file, I obtain a sound that has the bottom waveform which is obviously incorrect. However, the bottom waveform is nearly identical to the top half of the top waveform, which means the positive frequency components have been preserved.

File size:
52 KB
Views:
21
4. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
I beg to differ with your assertion that the bottom waveform is nearly identical top the top half of the upper waveform.

It appears to me that the lower waveform is the average of the positive side, and the absolute value of the negative side of the original waveform.

I've never used Matlab, so perhaps someone else will help you with that part.

5. ### Dave Retired Moderator

Nov 17, 2003
6,960
145
What you describe is a by-product of the Matlab HILBERT function. From the HILBERT function documentation:

A browse of the HILBERT function indicates that it performs the FFT, then conditions the range for positive components only, then applies the IFFT.

I would recommend you look at using the standard FFT and IFFT function in place of the HILBERT function without conditioning the range, before your post analysis. Have a look at the HILBERT function; type "edit hilbert" at the Matlab prompt and use that as your basis.

Dave

6. ### Dave Retired Moderator

Nov 17, 2003
6,960
145
What SgtWookie suggests may be worth considering, I too have some reservations about what the lower plot represents. But we will leave that to your intuition.

Dave

7. ### lamerooze Thread Starter New Member

Mar 13, 2008
4
0
Thanks guys for the replies and the help.

Will figure it out.