Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this without looping?

Status
Not open for further replies.

Icky

Computer
Feb 1, 2005
2
I'm working on simulating a full duplex conference phone in Matlab, so that I can test the code for the phone. One thing I'll be using it for is echo cancellation. The problem I've run into is that I'm forced to use a loop that is very timeconsuming, and I'm trying to find a better way of handling it in Matlab.

Below is some schematics of how I picture the system.
* IN1 and IN2 are vectors, sound, data into the system
* phone() is a function that can be changed depending on the application. Indata is one sample (int) and out is another (int)
* feedback() is a function that for each sample in produces an echo that is added to IN1 or IN2
* phoneline() is left out for this example
Code:
IN1 ---> phone() --> phoneline() --> phone() --> OUT1

feedback()                                       feedback()

OUT2 <-- phone() <-- phoneline() <-- phone() <-- IN2
An easy application using this system would be to have the phones working as regular speaker phones (half duplex), that is whoever talks louder gets to transmit.

Such an application would not transmit data coming from say IN2 if it had "louder" data on OUT1.

And this is where I get into trouble. Since my function phone() will change the indata of the whole system, I must loop it for every sample in IN1 and IN2.

Or are there some other nifty way to do such a thing in Matlab? Any ideas?

//Magnus
 
Replies continue below

Recommended for you

This is a fundamental problem with non-linear elements in a feedback path. You will not be able to vectorize. You might try an old trick though. Instead of having to make a sample by sample decision you could make small block decisions. This has been used in practice for exactly your application with block sizes as small as 2. That is, take in 2 samples (or 4 or almost any number) and do your more efficient block processing. On each block you can make switching decisions. You must deal with the delay issue and out of date linear information. That is still a problem. But, start with 2, and see if you algorithm does not degrade too much, and see if your MIPS issue improves at least a little bit.
Good luck!


 
Thanks for the reply man. It helps greatly knowing that you can't really do anything about it, means I can focus on other stuff that actually is solvable. :)

I'll be sure to try a block decision approach, if I ever get back to working on the actual project again. :)

Thanks

//Magnus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor