warning in Polyval - Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everybody.. I am having the following warning using polyval
It happens after I delete negative values from a dataset since before this cleaning it worked.
% TOLGO I VALORI NEGATIVI
% Creo un array di indici logici che indica quali righe hanno almeno un valore negativo
idx_neg = any(rawData < 0, 2);
cleanData = rawData;
% Elimino le righe selezionate
cleanData(idx_neg, :) = [];
pressureIN = cleanData(:,1);
pressureOUT= cleanData(:,2);
flowrate = cleanData(:,3);
PHeadLoss = pressureIN - pressureOUT;
%DATA
figure('Name',' PRESSURE HEAD LOSS vs FLOWRATE')
plot(flowrate, PHeadLoss, '*k');
title('Pressure Head Loss vs FLOW RATE');
xlabel('flow rate');
ylabel('P Head Loss');
hold on
%densityplot(flowrate, PHeadLoss, [50,50]);
[p, S, mu] = polyfit(flowrate, PHeadLoss, 2)
[y,delta] = polyval(p,flowrate,S,mu);
%LINEAR FIT
plot(flowrate, y, 'r-');
%hold on
% Linear Fit of Data with 95% Prediction Interval
%plot(flowrate,y+2*delta,'m--',flowrate,y-2*delta,'m--')
title('Pressure Head Loss vs FLOW RATE');
xlabel('flow rate');
ylabel('P Head Loss');
while the watning is:
p =
NaN NaN NaN
S =
struct with fields:
R: [3×3 double]
df: 751629
normr: NaN
mu =
NaN
NaN
Warning: Matrix is singular, close to singular or badly scaled.
Results may be inaccurate. RCOND = NaN.
> In polyval (line 109)
Thanks in advance!
1 commentaire
Réponses (1)
Bruno Luong
le 30 Jan 2024
Modifié(e) : Bruno Luong
le 30 Jan 2024
Check your data with this command
all(isfinite(rawData(:)))
if it returns 0/false then your data is not valid
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!