Reputation: 2150
for ii = 1:2:2*de.nP
G=[one, aux3(:,ii), aux3(:,ii) - aux2(:,ii),aux3(:,ii+1) - aux2(:,ii+1)];
try
betasPu(:,(ii+1)/2) =G\yM;
catch ME
betasPu(:,(ii+1)/2)=[Inf,Inf,Inf,Inf];
end
end
I am using the code above to try and catch instances when the G used in G\yM; is badly conditioned/singular.
I have used the code above but right now the catch does not seem to be triggering despite several badly conditioned/singular matrices being produced.
Upvotes: 3
Views: 2757
Reputation: 11168
I think badly conditioned calculations doesn't cause errors, only warnings? afaik warnings aren't caught..
There are however some circumventions:
lastwarn
to detect a warning.Upvotes: 4