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