How to plot more than Pfa in shindman equation

조회 수: 1 (최근 30일)
Meshaal Mouawad
Meshaal Mouawad 2019년 10월 7일
답변: Deepak Kumar 2019년 10월 10일
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