the Shnidman’s equations in matlab plot SNR vs pfa but I want to plot SNR vs N pulses
for example the probability of detection, a Swerling 1 target, three different probabilities of false alarm, Pd = 0.98; Swerling 1target; PFA = 10^‐8 ,10^‐6, 10^‐4
; N = 1 to 50
I am new to matlab and would love to know how to plot this

 Accepted Answer

In this case you can use shnidman to compute the SNR as a functionof N and then plot it manually, e.g.
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)')
HTH

7 Comments

what about 10^‐6, and 10^‐4?
The purpose of my example script is to show you the way. You will have to carry it through to solve your problem and I believe I've provided enough information here. If after you put together yours cript and you still have doubts about certain commands, feel free to respond again.
HTH
Meshaal Mouawad
Meshaal Mouawad on 7 Oct 2019
Edited: Meshaal Mouawad on 7 Oct 2019
I really need to understand the code how to polt more than Pfa in general as I see if i know this code I can also do many other things like the Albirshim and other functions;
this is the code I use now and stilll getting errors
N = 1:50;
Pd = 0.98;
Pfa = 1e-8:1e-4
SNR_1 = zeros(size(N));
SNR_2 = zeros(size(N));
SNR_3 = zeros(size(N));
for m = 1:numel(N)
SNR_1(m) = shnidman(Pd,Pfa,m,1);
SNR_2(m) = shnidman(Pd,Pfa,m,1);
SNR_3(m) = shnidman(Pd,Pfa,m,1);
end
plot(N,SNR_1);
hold on
plot(N,SNR_2);
plot(N,SNR_3);
xlabel('Number of Pulses');
ylabel('SNR (dB)')
if you include in your exaple how to plot 2 salfe alarms regardless to the number provided then me and any other reader can understand how to plot multiple line but you provided single plot; i went through the website for 2 days and saw multiple functions and methods then I put the quastion please show us how to plot 2 Pfs.
First of all, your code didn't error out in my machine. It probably didn't do what you want, but it didn't error.
I undersatnd that it might be frustrating as you are new to MATLAB, but sometimes you just need to spend some time checking the output of each line and see if it is what you want. For example, you need to understand what : means. By default A:B means generating a vector from A to B with a step size of 1. Therefore if you call it as 1e-8:1e-4, it actually is just one number, 1e-8 since 1e-8+1 already exceeds the upper bound, 1e-4. You can find this out by checking what Pfa is.
For your purpose, you may want to define Pfa as a vector containing all the numbers you want, then pass those value individually to compute SNR_1, SNR_2, and SNR_3. Then your code will work.
HTH
I got it ! by defining Pfa = [Pfa1 Pfa2 Pfa3 ...etc] where Pfa's is the number of Pfa nedded exp: [1e-3 1e-4 1e-5]
N = 1:50;
Pd = 0.98;
Pfa = [1e-8 1e-3 1e-5];
SNR_1 = zeros(size(N));
SNR_2 = zeros(size(N));
for m = 1:numel(N)
SNR_1(m) = shnidman(Pd,Pfa(1),m,1);
SNR_2(m) = shnidman(Pd,Pfa(2),m,1);
SNR_3(m) = shnidman(Pd,Pfa(3),m,1);
end
plot(N,SNR_1);
hold on
plot(N,SNR_2);
plot(N,SNR_3);
xlabel('Number of Pulses');
ylabel('SNR (dB)')
very nice, glad you got it

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

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

Start Hunting!