Add a varying phase shift to a sine wave (linspace involved)
41 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
Adeola Bannis
le 12 Mar 2014
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:
3 commentaires
John D'Errico
le 12 Mar 2014
um, Note that when you form a sum of two such vectors, both of which are linear sequences, you do NOT get a phase shift!!! A phase shifted series should have the same frequency as the old series. Note that the plots as shown do NOT. My point is, this answer does NOT provide a uniform phase shift.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Waveform Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!