From: sbk kunwar on 8 Jul 2010 22:30 hi all, i am new to matlab and i do not know much about the codes. i am doing a research in extreme value theory and i have been looking at the matlab codes that is posted online. This is the code for the qq-plot: function c=qplot(data,xi,ltrim,rtrim) data=surecol(data); line=1; if nargin < 2, error('Data and xi inputs should be supplied at least'); elseif nargin == 3, error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); elseif nargin == 4, if ~isempty(ltrim)&&~isempty(rtrim), error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); end if ~isempty(ltrim) && isempty(rtrim) data=data(data<=ltrim); elseif ~isempty(rtrim) && isempty(ltrim), data=data(data>=rtrim); else error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); end else end if xi==0, ylab='Exponential Quantiles'; y= expinv(ppoints(data),1); end if xi~=0, ylab=['GPD Quantiles; xi=' num2str(xi)]; y=qgpd(ppoints(data),xi); end plot(sort(data),y,'.'); if line==1, hold on, x=sort(data); b=regress(y',[ones(size(x)) x]); plot([(1/b(2))*(max(y)-b(1));(1/b(2))*(min(y)-b(1))],[max(y);min(y)],'k'); scx=range(x)/20;scy=range(y)/20; axis([min(x)-scx max(x)+scx min(y)-scy max(y)+scy]); hold off end ylabel(ylab); xlabel('Ordered Data'); When i try to make the qq-plot, i am to put the data and the value of xi. however i get the error message when the xi is 0 ??? Undefined function or method 'expinv' for input arguments of type 'double'. Error in ==> qplot at 40 y= expinv(ppoints(data),1); and when the xi is other than 0, i get the message ??? Undefined function or method 'regress' for input arguments of type 'double'. Error in ==> qplot at 50 b=regress(y',[ones(size(x)) x]); Can anyone please tell me what seems to be the problem. I really need this code to work but i do not know what to do. Any help would be really appreciated
From: Wayne King on 9 Jul 2010 03:20 "sbk kunwar" <samratkunwar(a)hotmail.com> wrote in message <i161k0$fm0$1(a)fred.mathworks.com>... > hi all, > i am new to matlab and i do not know much about the codes. i am doing a research in extreme value theory and i have been looking at the matlab codes that is posted online. > > This is the code for the qq-plot: > > function c=qplot(data,xi,ltrim,rtrim) > > data=surecol(data); > line=1; > > > if nargin < 2, > error('Data and xi inputs should be supplied at least'); > elseif nargin == 3, > error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); > elseif nargin == 4, > if ~isempty(ltrim)&&~isempty(rtrim), > error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); > end > if ~isempty(ltrim) && isempty(rtrim) > data=data(data<=ltrim); > elseif ~isempty(rtrim) && isempty(ltrim), > data=data(data>=rtrim); > else error('One of ltrim and rtrim inputs should be defined, the other should be left undefined and entered as ''[ ]'''); > end > else > end > > > if xi==0, > ylab='Exponential Quantiles'; > y= expinv(ppoints(data),1); > end > if xi~=0, > ylab=['GPD Quantiles; xi=' num2str(xi)]; > y=qgpd(ppoints(data),xi); > end > plot(sort(data),y,'.'); > if line==1, > hold on, > x=sort(data); > b=regress(y',[ones(size(x)) x]); > plot([(1/b(2))*(max(y)-b(1));(1/b(2))*(min(y)-b(1))],[max(y);min(y)],'k'); > scx=range(x)/20;scy=range(y)/20; > axis([min(x)-scx max(x)+scx min(y)-scy max(y)+scy]); > hold off > > end > > ylabel(ylab); > xlabel('Ordered Data'); > > When i try to make the qq-plot, i am to put the data and the value of xi. however i get the error message when the xi is 0 > > ??? Undefined function or method 'expinv' for input arguments of > type 'double'. > > Error in ==> qplot at 40 > y= expinv(ppoints(data),1); > > and when the xi is other than 0, i get the message > ??? Undefined function or method 'regress' for input arguments of > type 'double'. > > Error in ==> qplot at 50 > b=regress(y',[ones(size(x)) x]); > > Can anyone please tell me what seems to be the problem. I really need this code to work but i do not know what to do. Any help would be really appreciated Hi, do you have the Statistics Toolbox? Both expinv and regress are functions in the Statistics Toolbox. It appears from your error messages that your installation does not have these functions. By the way, if you get the Statistics Toolbox, there is a function qqplot, which will do what you want. Wayne
|
Pages: 1 Prev: Linking a C program with Matlab engine Next: contour vs boundary |