pleas! what is wrong in this program?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
lona johibary
am 15 Feb. 2020
Kommentiert: lona johibary
am 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, 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 Kommentare
Star Strider
am 16 Feb. 2020
Please copy the entire error message — all the red text — and paste it to a Comment here.
Akzeptierte Antwort
KALYAN ACHARJYA
am 16 Feb. 2020
Bearbeitet: KALYAN ACHARJYA
am 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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Propagation and Channel Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!