首页 / 产品 / 数值算法库 / NAG 工具箱®
虽然 NAG 算法库是用 Fortran 语言所编写的,但是您可以在 MATLAB 环境中调用它,如同是 MATLAB 本身提供的函数。在 MATLAB 工具箱中的函数会将数据传递到 Fortran 函数中,并将算法计算的成功后的结果转化成 MATLAB 的对象传回。
a = [ 1.80, 2.88, 2.05, -0.89; 5.25, -2.95, -0.95, -3.80; 1.58, -2.69, -2.90, -1.04; -1.11, -0.66, -0.59, 0.80]; b = [ 9.52; 24.35; 0.77; -6.22]; [aOut, ipiv, bOut, info] = f07aa(a, b); bOut bOut = 1.0000 -1.0000 3.0000 -5.0000
[aOut, ipiv, bOut, info] = f07aa(a, b, 'n', int32(3)); bOut bOut = 4.1631 -2.1249 3.9737 -6.2200
[aOut, ipiv, bOut, info] = f07aa(a(1:3,1:3), b(1:3)); bOut bOut = 4.1631 -2.1249 3.9737
tail = 'c'; a = [-2; -2; -2; -2]; b = [2; 2; 2; 2]; xmu = [0; 0; 0; 0]; sig = [1.0, 0.9, 0.9, 0.9; 0.9, 1.0, 0.9, 0.9; 0.9, 0.9, 1.0, 0.9; 0.9, 0.9, 0.9, 1.0]; g01hb(tail, a, b, xmu, sig) ans = 0.9142
g01hb(tail, a, b, xmu, sig,'tol',0.1) ans = 0.9182
??? The dimension of parameter 2 (A) should be at least 4
warning('off', 'NAG:warning')
s01ea(0) ??? Parameter number 1 is not a complex scalar of class double.
d01ah(0, 1, 1e-5, 'd01ah_f', int32(0)) ans = 3.1416
function [result] = d01ah_f(x) result=4.0/(1.0+x^2);
© Numerical Algorithms Group Visit NAG on the web at:www.nag.co.uk (Europe and ROW) www.nag.com (North America) www.nag-j.co.jp (Japan) http://cn.nag-gc.com/numeric/mb/calling.asp