⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iscor.m

📁 copua是金融数学计算中的一类新模型。本代码提供了最常用的copula模型
💻 M
字号:
function t = iscor(R)
%ISCOV Is a matrix a correlation matrix?
%   T = ISCOV(R) returns a logical value indicating whether or not the
%   matrix R is a valid correlation matrix, i.e., whether it is symmetric,
%   positive semidefinite, with ones on the diagonal.

%   Written by Peter Perkins, The MathWorks, Inc.
%   Revision: 1.0  Date: 2003/09/05
%   This function is not supported by The MathWorks, Inc.
%
%   Requires MATLAB R13.

[n,m] = size(R);
% test square, unit diagonal, symmetric
if (n == m) && all(diag(R) == 1) && all(all(abs(R - R') < 10*eps))
    e = eig(.5*(R + R'));
    % test positive semidefinite
    if all(e > -abs(max(e))*n*eps)
        t = true;
    else
        t = false;
    end
else
    t = false;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -