Undefined function 'pout2' for input arguments of type 'double'.

clc;
clear all;
Pa=9;
R=3;
beta=8;
N=4;
P0=0.3126;
q1= 0:1:12;
pout3=1-exp(-(((2^R)-1)/(P0))^(beta/2));
for j=1:length(q1)
k = floor((q1*N)/Pa);
for jj = 1:N-k-1
P(j,jj)=0;
pout1(j,jj)=1-exp(-(((2^R)-1)/(P(j,jj)))^(beta/2));
end
for l = N-k+1:N
PP(j,l)=((N*q1)-P0)/k;%ko;
pout2(j,l)=1-exp(-(((2^R)-1)/(PP(j,l)))^(beta/2));
end
end for j=1:length(q1)
outage_f(j)=((pout1(j,:)+sum(pout2(j,N-k+1:N))+ pout3)/N);
end
plot(q1,outage_f,'*y');
grid on;
xlabel('transmit power');
ylabel('outage probability');
We are getting the error as follows
Undefined function 'pout2' for input arguments of type 'double'. Error in the (line 23) outage_f(j)=((pout1(j,:)+sum(pout2(j,N-k+1:N))+ pout3)/N);
Pls help us

답변 (1개)

Mischa Kim
Mischa Kim 2014년 1월 29일
Hello Ashly, in your code
outage_f(j)=((pout1(j,:)+sum(pout2(j,N-k+1:N))+ pout3)/N);
pout2 is not defined because you never enter the corresponding for-loop. Also note that with
k = floor((q1*N)/Pa);
k is not a scalar but a vector.

댓글 수: 9

which for loop are u referring
Can you suggest the modification to be done
As a side note, consider using the debugger to track down bugs. Insert break points in the code via mouse clicks right next to code lines and hit [Run]. With [Continue] and [Step] you can let the debugger run to the next break point or only one more step at a time.
We tried debugging but still getting error...can u suggest the modification....
q1 is a vector, therefore, k is one as well. Which is the reason the for-loop where pout2 should be computed is never executed. As a result, outage_f(j) cannot be calculated.
then what can be done to calculate outage....
I do not know what you need to solve and how you do it so I can only give you feedback on the syntax issues with your code. It seems k is supposed to be a scalar so I suggest you start there (currently it is a vector). I am positive you can get it done.
Actually this is our problem
If q1<Pa we have
Pi* = 0 , 1 i N-k-1
= P0', i=N-k
=(Nq1 - P0')/k , N-k+1 i N
Where q1 and k are given as follows
k =⌊(q1 * N)/Pa⌋
P0'= arg min(P belongs to p) F(P) + k*F[((N*q1)-P)/k],
with p= [0,Pb] union (N*q1/(k+1))
where N= total no.of blocks
i= no.of.blocks within total block
Pb=7.2
Pa=9.3
q1=average transmit power which varies from 1 to 10
F(P)= 1-(exp(-((2^(R))-1)/P)^(beta/2))
R=3
beta=8
our problem is to write a matlab code for Pi*
We need to plot for average transmit power and outage prob {F(P)}.....For P0' we found the value as 0.3762

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

질문:

2014년 1월 29일

댓글:

2014년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by