How to plot more than Pfa in shindman equation

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

回答(1 个)

Deepak Kumar
Deepak Kumar 2019-10-10
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

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by