code runs properly but the variables in workspace are not shown, How to resolve this issue?

1 次查看(过去 30 天)
% 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

采纳的回答

Yazan
Yazan 2021-7-7
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 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by