Error using gamfit . X must be non-negative.

6 vues (au cours des 30 derniers jours)
Arly Getha Purba
Arly Getha Purba le 21 Avr 2021
Commenté : Jeff Miller le 21 Avr 2021
clear;clc
%hist = 'access05_indo_daily.txt'; % as x
%obs = 'chirps05_indo_daily.txt'; % as y
hist = 'hfeb_.txt'; % as x
obs = 'ofeb.txt'; % as y
delimiterIn = ' ';
%headerlinesIn = 1;
x = importdata(hist);
y = importdata(obs);
[m,n] = size(y);
ycor = zeros(m,n);
%cpolys = zeros(n,4);
xi = x(:,4);
yi = y(:,4);
yi(yi<=0) = 0;
Pxi = gamfit(xi);
Pyi = gamfit(yi(~isnan(yi)));
xgrid = linspace(0,1,101);
xinv = gaminv(xgrid,Pxi(1),Pxi(2)); xinv = xinv(1:100); % nilai ke 101 biasanya infinite value, jadi harus dibuang
yinv = gaminv(xgrid,Pyi(1),Pyi(2)); yinv = yinv(1:100); % nilai ke 101 biasanya infinite value, jadi harus dibuang
cpoly = polyfit(xinv,yinv,4);
%cpolys(i,:) = cpoly;
  5 commentaires
Arly Getha Purba
Arly Getha Purba le 21 Avr 2021
but there is no negative values both for the historical and the observation data. Am I have to change the distribution?
Jeff Miller
Jeff Miller le 21 Avr 2021
Any zeros? Does this work:
Pxi = gamfit(xi(xi>0));

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Particle & Nuclear Physics dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by