Clear Filters
Clear Filters

Ploting Rayleigh faded signal copies

2 views (last 30 days)
Ali Sabra
Ali Sabra on 23 Oct 2019
Answered: Daniel M on 23 Oct 2019
Hello everyone, I am looking for a way to sum a Rayleigh faded sine wave with its delayed Rayleigh faded version. I am trying to plot them in figure and to plot the original signal in another one to see the difference. I want to plot both of them versus time not only the original signal as in the figure.
c1 = rayleighchan(1/1600,100);
%c1.PathDelays = [0 1e-6];
%%Time specifications:
Fs = 1600; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 62.5; % seconds
t = (0:dt:StopTime-dt)'; % seconds
%Sine wave
Fc = 1; % hertz
sin = cos(2*pi*Fc*t);
% Plot the signal versus time:
figure (6);
%subplot (2,2,1)
%plot(t,sin);
%xlabel('time (in seconds)');
% title('Signal versus Time');
% zoom xon;
%subplot(2,2,2)
sin1 = filter (c1,sin);
% plot (t,10*log10 (abs(sin1)));
%subplot(2,2,3)
plot (t,sin1);
xlabel('time (in seconds)');
title('Signal versus Time');
% now shift the signal in time by zeropadding at the beginning:
tau = 802*dt;
y = [ tau ; sin1 ];
% Also, let's zeropad x at the end so that it has the same length as y:
sin1 = [ sin1 ; tau ];
% Create a simple time domain:
n = (1:size(z,1))';
z = sin1 + y;
% plot both signals:
figure(2);
plot(n,z,'r');
legend('z');

Accepted Answer

Daniel M
Daniel M on 23 Oct 2019
figure
plot(t,real(sin1))
hold on
plot(t,imag(sin1))
xlabel('Time')
Or, using subplot
figure
subplot(2,1,1)
plot(t,real(sin1))
title('title for subplot1')
xlabel('xlabel for subplot 1')
subplot(2,1,2)
plot(t,imag(sin1))
title('title for subplot 2') % etc...

More Answers (0)

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

Products


Release

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!