code runs properly but the variables in workspace are not shown, How to resolve this issue?
1 view (last 30 days)
Show older comments
% Matched Filter Probability of Detection
clear
mySNR = -30:30;
find_PD_MF(10,mySNR);
function find_PD_MF(threshold,snr)
waveform = phased.LinearFMWaveform('PulseWidth',1e-4,'PRF',5e3,...
'SampleRate',1e6,'OutputFormat','Pulses','NumPulses',1,...
'SweepBandwidth',1e5);
wav = getMatchedFilter(waveform);
inputSignal = waveform();
taylorfilter = phased.MatchedFilter('Coefficients',wav,...
'SpectrumWindow','Taylor');
N= length(inputSignal);
for i = 1:length(snr)
filtredSignal_taylor = abs(taylorfilter(awgn(inputSignal,snr(i))));
PD(100) = 0;
for j=1:100
highValue = filtredSignal_taylor > threshold;
PD(j) = sum(highValue)/N;
end
Pd = sum(PD)/100;
disp(pd);
plot(snr(i),Pd,'r+');
hold on
title('Matched Filter')
xlabel('SNR (db)')
ylabel('Probaility of Detection')
end
hold off
end
0 Comments
Accepted Answer
Yazan
on 7 Jul 2021
find_PD_MF is a Matlab function. You declared your function without outputs. Therefore, Matlab will not return any output of your function to the workspace. Declare one or more outputs to return them to the workspace.
Example: A function that takes two inputs threshold and snr and return an output Pd to the workspace.
function Pd = find_PD_MF(threshold, snr)
% write your function
pd = threshold/snr;
end
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!