Prev: there is something wrong somewhere in my matlab code
Next: Reading mouse position while the mouse is moving in GUI
From: bethebest ho on 13 Aug 2010 03:15 snr=100; >> beta=10; >> Qe1=2*snr*rand(0,1000);Qea=2*snr*rand(0,1000); >> Qi1=2*snr*rand(0,1000);Qia=2*snr*rand(0,1000); >> Qe1=2*snr-Qea-Qi1-Qia; >> a=(beta^2)*Qe1/(1+(beta^2)*Qi1); >> b=(beta^2)*Qea/(1+(beta^2)*Qia); >> alpha=1; c=(sqrt(Qe1)+alpha*sqrt(Qea)).^2; >> d=1+Qi1+(alpha^2)*Qia; >> e=c/d; if {min(a,b)>=e} re=0.5*log2(1+e); ri=0.5*log2(1+(beta^2)*Qi1)+0.5*log2(1+(beta^2)*Qia); else {min(a,b)<e} re=0.5*log2(1+min(a,b)); ri=0.5*log2(1+(beta^2)*Qi1)+0.5*log2(1+(beta^2)*Qia); end; the error is this ??? Conversion to logical from cell is not possible.
From: Ross W on 13 Aug 2010 03:38
"bethebest ho" <yellow11803(a)yahoo.com.tw> wrote in message <i42rea$boo$1(a)fred.mathworks.com>... > snr=100; > >> beta=10; > >> Qe1=2*snr*rand(0,1000);Qea=2*snr*rand(0,1000); > >> Qi1=2*snr*rand(0,1000);Qia=2*snr*rand(0,1000); > >> Qe1=2*snr-Qea-Qi1-Qia; > >> a=(beta^2)*Qe1/(1+(beta^2)*Qi1); > >> b=(beta^2)*Qea/(1+(beta^2)*Qia); > >> alpha=1; > c=(sqrt(Qe1)+alpha*sqrt(Qea)).^2; > >> d=1+Qi1+(alpha^2)*Qia; > >> e=c/d; > if {min(a,b)>=e} > re=0.5*log2(1+e); > ri=0.5*log2(1+(beta^2)*Qi1)+0.5*log2(1+(beta^2)*Qia); > else {min(a,b)<e} > re=0.5*log2(1+min(a,b)); > ri=0.5*log2(1+(beta^2)*Qi1)+0.5*log2(1+(beta^2)*Qia); > end; > > the error is this > ??? Conversion to logical from cell is not possible. Hi You have used {} instead of () in this line: if {min(a,b)>=e} Ross |