# How to plot more than Pfa in shindman equation

4 views (last 30 days)
Meshaal Mouawad on 7 Oct 2019
Answered: Deepak Kumar on 10 Oct 2019
How to plot more than Pfa in shindman equation function ?
I am ploting SNR vs N
this is the code I used
N = 1:50;
Pd = 0.98;
Pfa = 1e-6;
SNR = zeros(size(N));
for m = 1:numel(N)
SNR(m) = shnidman(Pd,Pfa,m,1);
end
plot(N,SNR);
xlabel('Number of Pulses');
ylabel('SNR (dB)')
for example what if iwould lke to plot Pfa of 1e-3, 1e-7 and so on

Deepak Kumar on 10 Oct 2019
Make pfa as a vector and put all the values of pfa into this e.g. Pfa = [1e-6,1e-3,1e-7];
Now use another loop to iterate through the different values of pfa vector. Basically, you can use loop within loop. The outer loop will iterate through the different values of pfa vector and the inner loop will make the plot for that particular value of pfa. I have modified your code to achieve this task. Check the code given below:
clc
clear all
close all
N = 1:50;
Pd = 0.98;
Pfa = [1e-6,1e-3,1e-7]; % put all the values of pfa here
L=length(Pfa); %get the length of pfa
for i=1:L
SNR = zeros(size(N));
for m = 1:numel(N)
SNR(m) = shnidman(Pd,Pfa(i),m,1);
end
figure(i) %make separate figure for each plot
plot(N,SNR);
xlabel('Number of Pulses');
ylabel('SNR (dB)')
title(['SNR vs No of pulses for pfa=',num2str(Pfa(i))])
end