why my plotting doesnt follow my line_effect?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Fatma Abdullah
le 11 Juin 2017
Réponse apportée : Walter Roberson
le 11 Juin 2017
i want my plotting to have a different line effects for each value of "c" but all curves comes out the same line effect
clc;
close all;
M=8;
N=32;
K=14;
cc=[0.8 1.2 1.6 2];
P=4;
s=2;
line_effect = {'g:','b:','r--','g--'};
for Q=1:P
c=cc(Q)
syms i
nT=50;
%nlambda = 50;
Tvals = linspace(0,30,nT);
%lambdavals2 = linspaace(0,30,nlambda);
%lambdavals = 10.^(lambdavals2/10);
pfa=zeros(0,nT);
%pd = zeros(1, nlambda);
stop_count = nT;
%stop_count = nlambda;
for L = 1 : nT
T=Tvals(L)
%lambda = lambdavals(L)
Tc=T.^(c/2) %constant sub-expression factored out
pd1temp = arrayfun(@(i) nchoosek(N/2,i) * gamma(K+i) * gamma(N-K-i+1+Tc), K : N/2, 'Uniform', 0); %constant denominator removed from terms
pd1sum = sum( [pd1temp{:}] ) ./ gamma(N+1+Tc); %this is the first symsum
pfa1 = 2 * K * nchoosek(N/2,K)* pd1sum;
pfatemp = arrayfun(@(i) nchoosek(M,i)*(pfa1)^(i)*(1-pfa1)^(M-i), s:M, 'Uniform' ,0);
pfasum = sum( [pfatemp{:}] ); %this is the second symsum
if L > 1
if pfasum > pfa(L-1)
stop_count = L-1;
break;
end
end
pfa(L) = pfasum;
end
semilogy(Tvals(1:stop_count), pfa(1:stop_count),line_effect{s});hold on
axis([0.1 30.1 10^(-26) 10^(1)])
end
legend('c=2','c=1.6','c=1.2','c=0.8')
0 commentaires
Réponse acceptée
Walter Roberson
le 11 Juin 2017
semilogy(Tvals(1:stop_count), pfa(1:stop_count), line_effect{Q}); hold on
0 commentaires
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!