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 8729445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:06+00:00 2026-06-13T08:50:06+00:00

I use the function below to generate the betas for a given set of

  • 0

I use the function below to generate the betas for a given set of guess lambdas from my optimiser.

When running I often get the following warning message:

Warning: Matrix is singular to working precision.
In NSS_betas at 9
In DElambda at 19
In Individual_Lambdas at 36

I’d like to be able to exclude any betas that form a singular matrix form the solution set, however I don’t know how to test for it?

I’ve been trying to use rcond() but I don’t know where to make the cut off between singular and non singular?

Surely if Matlab is generating the warning message it already knows if the matrix is singular or not so if I could just find where that variable was stored I could use that?

function betas=NSS_betas(lambda,data)

mats=data.mats2'; 
lambda=lambda;
yM=data.y2';
nObs=size(yM,1);
G= [ones(nObs,1) (1-exp(-mats./lambda(1)))./(mats./lambda(1)) ((1-exp(-mats./lambda(1)))./(mats./lambda(1))-exp(-mats./lambda(1))) ((1-exp(-mats./lambda(2)))./(mats./lambda(2))-exp(-mats./lambda(2)))];

betas=G\yM;
r=rcond(G);

end

Thanks for the advice:

I tested all three examples below after setting the lambda values to be equal so guiving a singular matrix

 if (~isinf(G))
  r=rank(G);
  r2=rcond(G);
  r3=min(svd(G)); 
 end

r=3, r2 =2.602085213965190e-16; r3= 1.075949299504113e-15;

So in this test rank() and rcond () worked assuming I take the benchmark values as given below.

However what happens when I have two values that are close but not exactly equal?

How can I decide what is too close?

  • 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-13T08:50:07+00:00Added an answer on June 13, 2026 at 8:50 am

    rcond is the right way to go here. If it nears the machine precision of zero, your matrix is singular. I usually go with:

    if( rcond(A) < 1e-12 )
        % This matrix doesn't look good
    end
    

    You can experiment with a value that suites your needs, but taking the inverse of a matrix that is even close to singular with MATLAB can produce garbage results.

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

Sidebar

Related Questions

I'm trying to use the function below to get a DIV to slide-out from
I am trying to use ajax like below; jquery code: $(a.generate).click(function(){ $.ajax({ data: {tag:
I use function below to check connection to WiFi hotspot point: public boolean IsWiFiConnected(){
When I use jQuery event listener to handle message event, like below: $(window).on('message', function(e)
I use a function that sends emails to some users. I use the following
I use PHP to generate XML files. I have use some code below to
I am having problems running the below recursive function on our development web server.
I'm trying to generate timestamp for cXML as shown below. Is there any function
Below is my object structure, I get the list of OrganizationVO from db. Could
I'm testing the VB function below that I got from a Google search. I

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.