Asked by Andrew
on 12 Mar 2014

Hello,

I have created a sine wave using the linspace function (see below), and using that wave and another one at a different frequency I have created an FSK signal by adding them together. Now I want to add another sine signal to this FSK signal but with a varying phase shift in order to simulate a fading channel.

ask1 = sin(linspace(0,2*pi*f1*transmission_time,total_samples));

So far I was just able to add a signal with a constant phase shift therefore my channel is not realistic enough and that is why I want to introduce a varying phase shift. The code used for the constant phase shift follows:

fade_sig = sin(linspace(0,2*pi*f1*transmission_time,total_samples) - (pi));

Some limitations are that I do not want to change the linspace function use in order to create the sine wave, as it is a vital component to my program because of the use of samples(total_samples) in order to create graphs and produce good results. Some ideas are the use of for loops and pre-creating a vector of phase shift and then using that to add it to the signal but seems too complicated to implement because of the use of the linspace function. Is there a easier method that I can approach this issue.

Thank you in advance Andrew

Answer by Adeola Bannis
on 12 Mar 2014

Accepted Answer

I think you should be able to get what you want by pre-creating a vector of phase shifts. As long as it is the same shape (column vs row, and length) as the original signal, it should work.

For example:

sample_times = linspace(0,2*pi*f1*transmission_time,total_samples);

ask1 = sin(sample_times);

r = linspace(-0.2, 0.2, total_samples);

fade_sig = sin(sample_times + r);

This is what I get when I plot ask1 and fade_sig:

Andrew
on 12 Mar 2014

John D'Errico
on 12 Mar 2014

Andrew
on 12 Mar 2014

Dear John,

I don't exactly understand what you mean, but after some tests with just this part of my program I am getting what I want. And even in the main program the code seems to work fine, I am getting bit errors after decoding the fsk signal due to the fact that sometimes the signal with frequency f1 has been cancelled out due to this fading signal( which at some point it will be at 180 out of phase) causing these desirable wrong decisions in the decoder. Let me demonstrate using the following code:

z = (1:10000);

total_samples = 10000;

f1=1;

transmission_time = 5;

sample_times = linspace(0,2*pi*f1*transmission_time,total_samples);

ask1 = sin(sample_times);

r = linspace(-2*pi, 2*pi, total_samples);

fade_sig = sin(sample_times + r);

final = ask1 + fade_sig;

plot(z,ask1,z,fade_sig);

figure

plot(z,final);

The following graphs are obtained:

and the resultant signal is :

Which is what I pretty much want, a signal with fades and amplifications which is what a fading channel cause due to multipath propagation.

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.