A function in file exchange which is not clear to me

조회 수: 1 (최근 30일)
JazzMusic
JazzMusic 2017년 1월 25일
댓글: Jan 2017년 1월 25일
Hi,
I am running a matlab file which is using this function. The code written there is here below my question.
My problem is: the whole code is under a comment sign. Is it written in an algorithmic-like way?
Does anyone understand what is the code I should use?
Thanks!
function [y]=bivnor(a,b,rho)
%function [y]=bivnor(a,b,rho)
%
% This function give an approximation of
% cumulative bivariate normal probabilities
%
% 1 x^2 - 2*r*x*y + y^2
% f(x,y,r)= ---------------------- exp(- ----------------------)
% 2*pi*(1-r^2)^(1/2) 2 - 2r^2
%
% bivnor(a,b,ro)=Int(a..infinity) Int(b..infinity) f(x,y,r) dx dy
%
% Note : Mex compile the file bivnor.c before using it.
%
% Based on Fortran code in Commun. ACM oct 1973 p638 Algo 462
% Translated to C by Ajay Shah (ajayshah@usc.edu)
% Sligtly modified for Matlab compatibility by Moranvil william (moranviw@onid.orst.edu)
%
% 2004 William Moranvil (moranviw@onid.orst.edu)
%

채택된 답변

Walter Roberson
Walter Roberson 2017년 1월 25일
You missed this:
% Note : Mex compile the file bivnor.c before using it.
That is, the real code is in the .c file and the file you are looking at is just the help documentation.
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 1월 25일
Once you have your compiler installed and configured, then cd to the directory where bivnor.c is stored, and give the command
mex bivnor.c
Once it succeeds, make sure that directory is on your MATLAB path and you will be able to call bivnor() as if it were a built-in function.
Jan
Jan 2017년 1월 25일
@JazzMusic: Then the command help bivnor displays the help text from the comments in the M-file, while y=bivnor(a,b,rho) calls the compiled MEX file.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by