警告:等级不足,MATLAB [英] Warning: Rank deficient, MATLAB
本文介绍了警告:等级不足,MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在收到错误提示:
I've been recieving an error stating:
Warning: Rank deficient, rank = 1, tol = 3.845925e-13.
In ed1 at 38
Warning from ed1 at 38
pf2(i)= length (find(sum((y)/(sqrt(NV))).^2)/(n<Tgam))/1000000;
在命令promopt中在[y1,y2,y3,y4]= ed1(1,1,20,2);
中运行以下代码类型.导致此错误的行是pf2(i)
和pd2(i)
to run the below code type in [y1,y2,y3,y4]= ed1(1,1,20,2);
in the command promopt. the lines causing this error are pf2(i)
and pd2(i)
function [y1,y2,y3,y4]= ed1(SNRL,SNRS,SNRH,n) %ed is the energy detection
g1= SNRL:SNRS:SNRH;
g=10.^(g1/10); %SNR
beta=0.8; % is the probability pfa, it cannot be more than 1
pf1=zeros(1,length(g));
pd1=zeros(1,length(g));
pf2=zeros(1,length(g));
pd2=zeros(1,length(g));
x=zeros(n,1000000);
y=zeros(n,1000000);
NV=zeros(n,1000000);
for a= 1:g %diff SNR
for b= 1:n %DIFF USERS,users are columns
NV(a,b)=1*b ;%assigning a value to the element of the matrix.
end
end
for i=1 : g %samples
for j=1:n %diff users.
%NV=ones(1000000,n);
x(j,:)=randn(1,1000000)*sqrt(NV(i,j));
y(j,:)=randn(1,1000000)*sqrt(g(i)/NV(i,j))+x(j,:);
end
%Tgam is the threshold of gamma distribution
Tgam = gaminv((1-beta),n/2,(2/n)*(1+(g(i)/NV(i,j)))); %probab of flase detection;
pf2(i)= length (find(sum((y)/(sqrt(NV))).^2)/(n<Tgam))/1000000;
pd2(i)= length (find(sum(x/sqrt(NV)).^2)/n<Tgam)/1000000;
y1=pf1; y2=pd1; y3=pf2; y4=pd2;
end
是什么原因引起的建议?以及如何解决. 谢谢
any suggestion to what causes this? and how to solve please. thanks
推荐答案
在线
pf2(i)= length (find(sum((y)/(sqrt(NV))).^2)/(n<Tgam))/1000000;
您真的要执行矩阵除法吗?如果您对按元素划分感兴趣(即y
的第一个元素除以sqrt(NV)
的第一个元素等,则应使用./
:
do you really want to perform a matrix division? If you are interested in the element-wise division (i.e. the first element of y
divided by the first of sqrt(NV)
etc, you should use ./
:
pf2(i)= length (find(sum((y)./(sqrt(NV))).^2)/(n<Tgam))/1000000;
这篇关于警告:等级不足,MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文