pleas! what is wrong in this program?

3 views (last 30 days)
sampleTime = 1/500000; % Sample time (s)
maxDopplerShift = 200; % Maximum Doppler shift of diffuse components (Hz)
delayVector = 1.0e-004 * [0 0.0400 0.0800 0.1200]; % Discrete delays of
% four-path channel (s)
gainVector = [0 -3 -6 -9]; % Average path gains (dB)
specDopplerShift = 100; % Doppler shift of specular component (Hz)
KFactor = 10; % Linear ratio of specular power to diffuse power
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1; % Store channel state information as signal is
ricChanObj = ricianchan(sampleTime, maxDopplerShift, KFactor, ...
delayVector, gainVector, specDopplerShift);
ricChanObj.StoreHistory = 1; % Store channel state information as signal is
% processed for later visualization
phaseOff = pi/4;
modObj = modem.pskmod(4, phaseOff);
modObj.InputType = 'Bit';
bitsPerFrame = 1000;
msg = randint(bitsPerFrame,1);
modSignal = modulate(modObj, msg);
filter(rayChanObj,modSignal);
filter(ricChanObj, modSignal);
channel_vis(rayChanObj, 'Visualization', 'ir'); % View Impulse Response
channel_vis(rayChanObj, 'Animation', 'medium'); % Set animation speed
channel_vis(rayChanObj, 'SampleIndex', 1); % Set animation start point
channel_vis(rayChanObj, 'close'); % Close Channel Visualization Tool
sampleTime = 1/20000; % 20 kb/s transmission
bitsPerFrame = 1000;
numFrames = 20;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0; % Retain channel states across
% multiple frames
for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to the data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'gain');
delayVector = 0; % Single fading path with zero delay
gainVector = 0; % Average path gain of 1 (0 dB)
channel_vis(rayChanObj, 'close');
bitsPerFrame = 1000;
numFrames = 100;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0;
for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end
channel_vis(rayChanObj, 'Visualization', 'fr');
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'phasor');
channel_vis(rayChanObj, 'Animation', 'slow');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'gain');
channel_vis(rayChanObj, 'close');
channel_vis(rayChanObj, 'Visualization', 'doppler');
ricChanObj = ricianchan(sampleTime, maxDopplerShift, KFactor, delayVector, ...
gainVector, specDopplerShift);
ricChanObj.StoreHistory = 1;
bitsPerFrame = 1000;
msg = randint(bitsPerFrame,1);
modSignal = modulate(modObj, msg);
channel_vis(rayChanObj, 'close');
ricFiltSig = filter(ricChanObj,modSignal);
channel_vis(ricChanObj, 'Visualization', 'gain'); % Multipath components
channel_vis(ricChanObj, 'Visualization', 'phasor');
channel_vis(ricChanObj, 'Animation', 'slow');
channel_vis(ricChanObj, 'SampleIndex', 1);
delayVector = (0:3)*(4e-6);
gainVector = (0:3)*(-3);
maxDopplerShift = 5;
channel_vis(ricChanObj, 'close');
h = scatterplot(0);
title('Received Signal After Rayleigh Fading');
xlabel('In-Phase Amplitude'); % Set axis labels
ylabel('Quadrature Amplitude');
xlim([-2 2]); % Set axis limits
ylim([-2 2]);
grid on;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0;
numFrames = 100;
bitsPerFrame = 200;
for n = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
rayFiltSig = filter(rayChanObj,modSignal); % Apply channel filtering
set(get(get(h, 'Children'), 'Children'), 'XData', ...
real(rayFiltSig(6:end)), 'Ydata', imag(rayFiltSig(6:end)));
pause(0.05); % Pause between re-draws
drawnow; % Refresh the image
end
close(h);
reset(rayChanObj);
rayChanObj.InputSamplePeriod = 1/500000; % 500 kb/s transmission.
h = scatterplot(0); % Initialize scatter plot
title('Received Signal After Rayleigh Fading');
xlabel('In-Phase Amplitude'); % Set axis labels
ylabel('Quadrature Amplitude');
xlim([-2 2]); % Set axis limits
ylim([-2 2]);
grid on;
numFrames = 100;
bitsPerFrame = 200;
for n = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
rayFiltSig = filter(rayChanObj,modSignal); % Apply channel filtering
set(get(get(h, 'Children'), 'Children'), 'XData', ...
real(rayFiltSig(6:end)), 'Ydata', imag(rayFiltSig(6:end)));
pause(0.05); % Pause between re-draws
drawnow; % Refresh the image
end
close(h);
reset(rayChanObj);
bitsPerFrame = 1000;
rayChanObj.MaxDopplerShift = 200;
numFrames = 13;
for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to the data
end
channel_vis(rayChanObj, 'Visualization', 'irw');
channel_vis(rayChanObj, 'Animation', 'interframe');
channel_vis(rayChanObj, 'Visualization', 'fr');
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'compgain');
channel_vis(rayChanObj, 'Animation', 'interframe');
set(rayChanObj.MultipathFigure.FigureHandle,...
'Position', [544 447 700 525]);
displayEndOfDemoMessage(mfilename)
  4 Comments
Star Strider
Star Strider on 16 Feb 2020
Please copy the entire error message — all the red text — and paste it to a Comment here.
lona johibary
lona johibary on 16 Feb 2020
>> Untitled6
Warning: RAYLEIGHCHAN will be removed in a future release. Use COMM.RAYLEIGHCHANNEL instead. See this release note for more
information.
> In rayleighchan (line 112)
In Untitled6 (line 8)
Warning: RICIANCHAN will be removed in a future release. Use COMM.RICIANCHANNEL instead. See this release note for more
information.
> In ricianchan (line 76)
In Untitled6 (line 12)
Error using modem.pskmod (line 87)
MODEM.PSKMOD has been removed. See this release note for more information.
Error in Untitled6 (line 17)
modObj = modem.pskmod(4, phaseOff);

Sign in to comment.

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 16 Feb 2020
Edited: KALYAN ACHARJYA on 16 Feb 2020
sampleTime = 1/500000; % Sample time (s)
maxDopplerShift = 200; % Maximum Doppler shift of diffuse components (Hz)
delayVector=1.0e-004*[0 0.0400 0.0800 0.1200]; % Discrete delays of
% four-path channel (s)
gainVector = [0 -3 -6 -9]; % Average path gains (dB)
specDopplerShift = 100; % Doppler shift of specular component (Hz)
KFactor = 10; % Linear ratio of specular power to diffuse power
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1; % Store channel state information as signal is
ricChanObj = ricianchan(sampleTime, maxDopplerShift, KFactor, ...
delayVector, gainVector, specDopplerShift);
ricChanObj.StoreHistory = 1; % Store channel state information as signal is
% processed for later visualization
phaseOff = pi/4;
modObj = modem.pskmod(4, round(phaseOff));
modObj.InputType = 'Bit';
bitsPerFrame = 1000;
msg = rand(bitsPerFrame,1);
modSignal = modulate(modObj, round(msg));
filter(rayChanObj,modSignal);
filter(ricChanObj, modSignal);
channel_vis(rayChanObj, 'Visualization', 'ir'); % View Impulse Response
channel_vis(rayChanObj, 'Animation', 'medium'); % Set animation speed
channel_vis(rayChanObj, 'SampleIndex', 1); % Set animation start point
channel_vis(rayChanObj, 'close'); % Close Channel Visualization Tool
sampleTime = 1/20000; % 20 kb/s transmission
bitsPerFrame = 1000;
numFrames = 20;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0; % Retain channel states across
% multiple frames
for i = 1:numFrames
msg = randi(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to the data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'gain');
delayVector = 0; % Single fading path with zero delay
gainVector = 0; % Average path gain of 1 (0 dB)
channel_vis(rayChanObj, 'close');
bitsPerFrame = 1000;
numFrames = 100;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0;
for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end
channel_vis(rayChanObj, 'Visualization', 'fr');
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'phasor');
channel_vis(rayChanObj, 'Animation', 'slow');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'gain');
channel_vis(rayChanObj, 'close');
channel_vis(rayChanObj, 'Visualization', 'doppler');
ricChanObj = ricianchan(sampleTime, maxDopplerShift, KFactor, delayVector, ...
gainVector, specDopplerShift);
ricChanObj.StoreHistory = 1;
bitsPerFrame = 1000;
msg = randint(bitsPerFrame,1);
modSignal = modulate(modObj, msg);
channel_vis(rayChanObj, 'close');
ricFiltSig = filter(ricChanObj,modSignal);
channel_vis(ricChanObj, 'Visualization', 'gain'); % Multipath components
channel_vis(ricChanObj, 'Visualization', 'phasor');
channel_vis(ricChanObj, 'Animation', 'slow');
channel_vis(ricChanObj, 'SampleIndex', 1);
delayVector = (0:3)*(4e-6);
gainVector = (0:3)*(-3);
maxDopplerShift = 5;
channel_vis(ricChanObj, 'close');
h = scatterplot(0);
title('Received Signal After Rayleigh Fading');
xlabel('In-Phase Amplitude'); % Set axis labels
ylabel('Quadrature Amplitude');
xlim([-2 2]); % Set axis limits
ylim([-2 2]);
grid on;
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0;
numFrames = 100;
bitsPerFrame = 200;
for n = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
rayFiltSig = filter(rayChanObj,modSignal); % Apply channel filtering
set(get(get(h, 'Children'), 'Children'), 'XData', ...
real(rayFiltSig(6:end)), 'Ydata', imag(rayFiltSig(6:end)));
pause(0.05); % Pause between re-draws
drawnow; % Refresh the image
end
close(h);
reset(rayChanObj);
rayChanObj.InputSamplePeriod = 1/500000; % 500 kb/s transmission.
h = scatterplot(0); % Initialize scatter plot
title('Received Signal After Rayleigh Fading');
xlabel('In-Phase Amplitude'); % Set axis labels
ylabel('Quadrature Amplitude');
xlim([-2 2]); % Set axis limits
ylim([-2 2]);
grid on;
numFrames = 100;
bitsPerFrame = 200;
for n = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
rayFiltSig = filter(rayChanObj,modSignal); % Apply channel filtering
set(get(get(h, 'Children'), 'Children'), 'XData', ...
real(rayFiltSig(6:end)), 'Ydata', imag(rayFiltSig(6:end)));
pause(0.05); % Pause between re-draws
drawnow; % Refresh the image
end
close(h);
reset(rayChanObj);
bitsPerFrame = 1000;
rayChanObj.MaxDopplerShift = 200;
numFrames = 13;
for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to the data
end
channel_vis(rayChanObj, 'Visualization', 'irw');
channel_vis(rayChanObj, 'Animation', 'interframe');
channel_vis(rayChanObj, 'Visualization', 'fr');
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
channel_vis(rayChanObj, 'Visualization', 'compgain');
channel_vis(rayChanObj, 'Animation', 'interframe');
set(rayChanObj.MultipathFigure.FigureHandle,...
'Position', [544 447 700 525]);
displayEndOfDemoMessage(mfilename)
If it is OK do the same for second error (simillar)
  1 Comment
lona johibary
lona johibary on 16 Feb 2020
The error remains!
Warning: RAYLEIGHCHAN will be removed in a future release. Use COMM.RAYLEIGHCHANNEL instead. See this release note for more
information.
> In rayleighchan (line 112)
In Untitled7 (line 8)
Warning: RICIANCHAN will be removed in a future release. Use COMM.RICIANCHANNEL instead. See this release note for more
information.
> In ricianchan (line 76)
In Untitled7 (line 12)
Error using modem.pskmod (line 87)
MODEM.PSKMOD has been removed. See this release note for more information.
Error in Untitled7 (line 17)
modObj = modem.pskmod(4, round(phaseOff));
>> Untitled7
Warning: RAYLEIGHCHAN will be removed in a future release. Use COMM.RAYLEIGHCHANNEL instead. See this release note for
more information.
> In rayleighchan (line 112)
In Untitled7 (line 8)
Warning: RICIANCHAN will be removed in a future release. Use COMM.RICIANCHANNEL instead. See this release note for more
information.
> In ricianchan (line 76)
In Untitled7 (line 12)
Error using modem.pskmod (line 87)
MODEM.PSKMOD has been removed. See this release note for more information.
Error in Untitled7 (line 17)
modObj = modem.pskmod(4, round(phaseOff));

Sign in to comment.

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!