Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:46:57+00:00 2026-06-17T11:46:57+00:00

keep getting an indexing error ()-indexing must appear last in an index expression bascially

  • 0

keep getting an indexing error ” ()-indexing must appear last in an index expression”
bascially im trying to create a matrix x made of randn(n,1000000) where every jth row is multiplied by matrix NV(i,j).

%monte carlo simulation
function [y1,y2,y3,y4]= ed1(SNRL,SNRS,SNRH,n) %ed is the energy detection
g1= SNRL:SNRS:SNRH;
g=10.^(g1/10);
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,length(g));
y=zeros(n,length(g));

for i=1 : length(g)



for j=1:n
     NV=(i,j); 
    x(j,:) = randn(n,1000000)*sqrt(NV(i,j)); 
     y(j,:)=randn(n,1000000*(j),:)*sqrt(g(i))+x(j,:); 
end

 %Tgam is the threshold of gamma distribution 
 Tgam = gaminv((1-beta),n/2,(2/n)*(1+g(i))); %probab of flase detection
 pf1(i)= gamcdf(Tgam,n/2,(2/n)*(1+g(i))); %ho
 pd1 (i) = gamcdf(Tgam,n/2,2/n); %h1 % prob of detection

 pf2(i)= length (find(sum(y.^2)/n<Tgam))/1000000;
 pd2 (i) = length (find(sum(x.^2)/n<Tgam))/1000000; 

 y1=pf1; y2=pd1; y3=pf2; y4=pd2;
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:46:58+00:00Added an answer on June 17, 2026 at 11:46 am

    You have three things giving you errors:

    1) NV=(i,j) This syntax will give you an error message. If you are not getting an error message about this line, you have an error in the line calling this code and should post that too. Try NV=zeros(length(g),n); for a temporary fix until you know what NV should be.

    2) randn(n,1000000*(j),:) is also bad syntax. Do you mean randn(n,1000000*(j))?

    3) x(j,:) = randn(1,10000)*sqrt(NV(i,j));: x as written in your code is not the right size unless g is magically of length 10000.

    Hopefully checking these 3 things will give you an idea of what is giving your specific error message (which is not the same as any of the messages these errors gave me.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Keep getting this error after inserting a subdatasheet into a query and trying to
i keep getting a sytax error when trying to add (function (e) { e.preventDefault;
I keep getting this error message when trying to write to the Event log
I keep getting this error: java.lang.NoClassDefFoundError: org/apache/lucene/index/memory/MemoryIndex Is there any way i can go
I keep getting this error when trying to open a connection using entity framework.
I keep getting this error when trying to run the code: (let ((exp lambda
I keep getting the error below when trying to edit any of the data
I keep getting a undefined index error on my page. I have tried different
I keep getting this error when I try to create a new instance of
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.