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

1 visualización (últimos 30 días)
% 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

Respuesta aceptada

Yazan
Yazan el 7 de Jul. de 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

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by