matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)%QUAD Numerically evaluate integral,adaptive Simpson quadrature.% Q = QUAD(FUN,A,B) tries to approximate the

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 05:02:54
matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)%QUAD Numerically evaluate integral,adaptive Simpson quadrature.% Q = QUAD(FUN,A,B) tries to approximate the

matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)%QUAD Numerically evaluate integral,adaptive Simpson quadrature.% Q = QUAD(FUN,A,B) tries to approximate the
matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,
function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)
%QUAD Numerically evaluate integral,adaptive Simpson quadrature.
% Q = QUAD(FUN,A,B) tries to approximate the integral of scalar-valued
% function FUN from A to B to within an error of 1.e-6 using recursive
% adaptive Simpson quadrature.FUN is a function handle.The function
% Y=FUN(X) should accept a vector argument X and return a vector result
% Y,the integrand evaluated at each element of X.
%
% Q = QUAD(FUN,A,B,TOL) uses an absolute error tolerance of TOL
% instead of the default,which is 1.e-6.Larger values of TOL
% result in fewer function evaluations and faster computation,
% but less accurate results.The QUAD function in MATLAB 5.3 used
% a less reliable algorithm and a default tolerance of 1.e-3.
%
% Q = QUAD(FUN,A,B,TOL,TRACE) with non-zero TRACE shows the values
% of [fcnt a b-a Q] during the recursion.Use [] as a placeholder to
% obtain the default value of TOL.
%
% [Q,FCNT] = QUAD(...) returns the number of function evaluations.
%
% Use array operators .*,./ and .^ in the definition of FUN
% so that it can be evaluated with a vector argument.
%
% Notes:
% Function QUADL may be more efficient with high accuracies and smooth
% integrands.
% Function QUADV vectorizes QUAD for array-valued FUN.
%
% Example:
% Q = quad(@myfun,0,2);
% where myfun.m is the M-file function:
% %-------------------%
% function y = myfun(x)
% y = 1./(x.^3-2*x-5);
% %-------------------%
%
% or,use a parameter for the constant:
% Q = quad(@(x)myfun2(x,5),0,2);
% where myfun2 is the M-file function:
% %----------------------%
% function y = myfun2(x,c)
% y = 1./(x.^3-2*x-c);
% %----------------------%
%
% Class support for inputs A,B,and the output of FUN:
% float:double,single
%
% See also QUADV,QUADL,DBLQUAD,TRIPLEQUAD,TRAPZ,FUNCTION_HANDLE.
% Based on "adaptsim" by Walter Gander.
%
% Reference:
% [1] W.Gander and W.Gautschi,Adaptive Quadrature - Revisited,
% BIT Vol.40,No.1,March 2000,pp.84-101.
%
% Copyright 1984-2006 The MathWorks,Inc.
% $Revision:5.26.4.7 $ $Date:2006/04/03 17:10:41 $
f = fcnchk(funfcn);
if nargin < 4 || isempty(tol),tol = 1.e-6; end;
if nargin < 5 || isempty(trace),trace = 0; end;
if isscalar(a) || isscalar(b)
error('MATLAB:quad:scalarLimits',...
'The limits of integration must be scalars.');
end
% Initialize with three unequal subintervals.
h = 0.13579*(b-a);
x = [a a+h a+2*h (a+b)/2 b-2*h b-h b];
y = f(x,varargin{:});
fcnt = 7;
% Fudge endpoints to avoid infinities.
if isfinite(y(1))
y(1) = f(a+eps(superiorfloat(a,b))*(b-a),varargin{:});
fcnt = fcnt+1;
end
if isfinite(y(7))
y(7) = f(b-eps(superiorfloat(a,b))*(b-a),varargin{:});
fcnt = fcnt+1;
end

matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)%QUAD Numerically evaluate integral,adaptive Simpson quadrature.% Q = QUAD(FUN,A,B) tries to approximate the
这个是按着辛普森公式在计算,辛普森公式跟节点有关的,Y1应该是Y的第一个值,就是说第一次算出来的值,Y7是Y积分结果矩阵的第七个值,这个值都跟节点有关系.不好意思.这个辛普森公式在计算方法(或者数值分析里有详细介绍),我给忘记了!所以只能回答这么多!

这个问题有电晕

matlab quad 函数代码中的y(1) ,跟数值积分分成的n个节点有什么关系,function [Q,fcnt] = quad(funfcn,a,b,tol,trace,varargin)%QUAD Numerically evaluate integral,adaptive Simpson quadrature.% Q = QUAD(FUN,A,B) tries to approximate the matlab函数中的参数求叉积:A=cross(m,n)代码如下(很简单):%%函数定义,求叉积function B = fun1( x,y )m=[x,y,x+y];n=[x,2*y,2*x];A=cross(m,n);end;%%主函数a=quad( @(x) fun1(x,3),0,2 )%%如上,结果是在 A=cross(m,n); 这一 quad函数如何积带变量上下限的函数matlab中的积分问题 matlab数值积分函数的应用下面的代码可运行F = @(x)1./(x.^3-2*x-5);Q = quad(F,0,2); 为何下面的代码不能运行F = @(x)exp((log(x)-1)^2);Q = quad(F,0,2); 出错信息为:Error using ==> mpowerMatrix must be square.Error in ==> @ MATLAB求助,用MATLAB画出x与y的函数图象,最好有代码! 关于matlab的quad函数y='4*a*sqrt(1-(c/a)^2*sin(x)^2))';true=quad(y,0,2*pi,10^-6);为什么输入这样的指令总是出现如下错误Error using ==> inline.subsref at 14Not enough inputs to inline function.Error in ==> quad at 77y = f(x,varargi matlab中 如何用quad函数积上下限带变量的函数 matlab中怎样对二元函数中的一个变量做数值积分?例如函数y=f(a,b)怎样只对b积分?另外,quad()命令里会将已赋值符号也当做变量,当我需要对a赋值后再对b积分,应该怎样做? matlab中的二维曲线的颜色深浅随函数值的变化而变化,求教代码 Matlab 作函数的图像 y=1/x.^2求代码,立等. matlab中求拉氏变换函数的代码 怎样用quad进行数值积分?matlab被积函数是(2.53e-7*y-5.6e-5)/(0.2872+5.85-0.019*y)*y/1.1*exp(-0.5*y^2/1.1) 下限是222,上限是300 求matlab分段线性逼近曲线函数代码 曲线函数函数如下y=x+0.1xx, matlab中 积分函数quad使用问题 function y=density(x)xd=[-0.1:0.001:0.1];h=1.05*std(xd)*(length(xd)^(-1/5));y=1/(length(xd)*h)*sum(1/sqrt(2*pi)*exp(-(((x-xd)/h).^2)/2));end%%%quad(@density,0,1)%%运行上述语句发生错误 为什么?Error u 关于matlab多项式的表达在计算的时候,使用quad函数,quad('1./(x.^3-2*x-5)',0,2),请问式中‘1.’ ‘x.^3’ 中的1和x后面为什么加点‘.’而在有些时候多项式中x的后面不加点? 关于matlab中的diff函数...在matlab中明明定义了x y是符号变量为什么使用diff函数还是出错?代码如下:>> syms x y dydx;>> y='log(x)/x^2';>> dydx=diff(y)dydx =3 -8 -63 80 -79 6 73 -26 -44 matlab 积分函数作图问题式子里 函数变量是y 其他都是常量求代码啊 matlab根本没学过呢 函数图象 Matlab如何用Matlab画函数图像?需要代码吗?比如说y=xsinx的二维图像如何画?