Hi I need to simulate a simple multipath channel in matlab through which I can send my OFDM transmission signal, I want to test my OFDM receiver design. So far I have:

%% Passing through Channel
nIFFT = 4096;

% Create channel
channel = randn(1,nIFFT) + sqrt(-1)*randn(1,nIFFT);

% cext_data is the signal to be transmitted
after_channel = filter(channel, 1, cext_data); 

I get a warning when I run the transmitter:

Warning: Data clipped during write to file:ofdm_tx8khz.wav

and when I run the receiver I get:

Index exceeds matrix dimensions.

Error in ofdm_rx (line 26)

chunk2 = signal((s+nIFFT):(s+nIFFT+nCyclic-1));

I was really hoping someone could help me simulate a multipath channel for my OFDM program.

  • $\begingroup$ Personally I don't like when people are using sqrt(-1) for imaginary unit. First of all MATLAB has in-built variables: i, (1i), j. Secondly, from mathematical point of view solution for $\sqrt{-1}$ is both: $i$ and $-i$. $\endgroup$ – jojek Apr 24 '14 at 11:58

Wav files expect values from -1 to +1. You are probably exceeding those limits when you filter the signal through the channel model. After the channel filter add the following:

after_channel = after_channel / max(abs(after_channel));

I suspect, though, that you will still have a problem. I believe that wavwrite ignores the imaginary part of complex data, so you will be losing that part of the signal.

| improve this answer | |
  • $\begingroup$ Hi, thank you for your answer, I did try that and the error persists. What should I do? Is there any other way I could simulate a simple multipath channel for my program ? $\endgroup$ – user8572 Apr 24 '14 at 12:09
  • 2
    $\begingroup$ Then normalize it: after_channel_norm = after_channel ./ max(abs(after_channel)) $\endgroup$ – Deve Apr 24 '14 at 12:37
  • $\begingroup$ @Deve Good call. Modified the answer. $\endgroup$ – Jim Clay Apr 24 '14 at 13:48
  • $\begingroup$ Thanks for that, that did solve the data being clipped error however I am still getting the second error during the reception of the signal. The line with the error is in my cross-correlation i have made a number of changes but it still is giving the same error, here's the fucntion: codetidy.com/4165 $\endgroup$ – user8572 Apr 24 '14 at 15:26
  • $\begingroup$ @user8572 Questions about programming problems should really go to StackOverflow, not Signal Processing. $\endgroup$ – Jim Clay Apr 24 '14 at 17:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.