Problems evaluating Q-function. Error : The argument of the Q function must be a real array.
1 次查看(过去 30 天)
显示 更早的评论
I have a problem when I evaluate the results of qfunc(x). The reason behind this is that my input x to the qfunc, is actually a string, that contains a L symbol whose value is not known at the moment, so it does not evaluate it.
Programs runs well upto assignment of I and temp. when it enters in j for loop and start calculating P_d(j), it will create an error as
*??? Error using ==> qfunc at 19
The argument of the Q function must be a real array.
Error in ==> abc at 28
P_d(j)=simplify(qfunc(((E_l(j)/(p.^2))-s(j)-1)*(sqrt(M/(2*s(j)+1)))))
*
*Here is the code *
N=16
s=[.38 1.37 .32 .24 .35 .27 .39 .38 .74 .37 .51 .26 .31 .25 .23 .81]
r=[857 206 853 900 611 808 561 325 212 391 219 830 308 650 924 138]
p=1
c=[8.94 1.68 3.81 6.91 9.01 2.07 3.43 3.44 1.79 3.38 1.63 1.66 1.02 3.3 1.98 8.91]
a=.1
b=.2
M=150
g=1
syms L
for k=1:N
temp(k)=(p.^2)*(0.5+sqrt(((2*s(k)+1)/s(k))*((-1/M)*log10((L)*c(k)/(r(k)*sqrt(2*s(k)+1)))+s(k)/4)))
E_l(k)=simplify (temp(k))
end
I=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
temp=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
for j=1:N
P_d(j)=simplify(qfunc(((E_l(j)/(p.^2))-s(j)-1)*(sqrt(M/(2*s(j)+1)))))
P_m(j)=1-P_d(j)
temp(j)=c(j)*P_m(j)
I(j)=I(j)+temp(j)
end
2 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!