24小时热门版块排行榜    

查看: 662  |  回复: 2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

wql212

金虫 (小有名气)

[求助] matlab 中函数 rombint 的用法

如题,函数rombint 怎么用和意义是什么?
另外,一些连续的递推计算出来的数据,如何整合成一个连续的函数?
请高人指点!
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

wql212

金虫 (小有名气)

引用回帖:
2楼: Originally posted by libralibra at 2013-01-10 09:56:25
用法和函数原型
function =rombint(funfcn,a,b,decdigs,varargin);
%ROMBINT         Numerical evaluation of an integral using the Romberg method.
%
%   Q = rombint('F',A,B) approximates the integral of F(X ...

thank you ,but could you explain it to me?
3楼2013-01-10 17:08:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 3 个回答

libralibra

至尊木虫 (著名写手)

骠骑将军

【答案】应助回帖

★ ★ ★
感谢参与,应助指数 +1
csgt0: 金币+1, 谢谢 2013-01-11 15:11:43
wql212: 金币+2 2013-01-11 17:13:49
用法和函数原型
CODE:
function [res]=rombint(funfcn,a,b,decdigs,varargin);
%ROMBINT         Numerical evaluation of an integral using the Romberg method.
%
%   Q = rombint('F',A,B) approximates the integral of F(X) from A to B to
%   within a relative error of 1e-10 using Romberg's method of integration.
%   'F' is a string containing the name of the function.  The function
%   must return a vector of output values if a vector of input values is given.
%
%   Q = rombint('F',A,B,DECIMALDIGITS) integrates with accuracy 10^{-DECIMALDIGITS}.
%
%   Q = rombint('F',A,B,DECIMALDIGITS,P1,P2,...) allows coefficients P1, P2, ...
%   to be passed directly to the function F:   G = F(X,P1,P2,...).
%
%   Tested under MATLAB 5.2, works with all subsequent releases.
%   ---------------------------------------------------------
%   Author: Martin Kacenak,
%           Department of Applied Informatics and Process Control,
%           Faculty of BERG, Technical University of Kosice,
%           B.Nemcovej 3, 04200 Kosice, Slovak Republic
%   E-mail: ma.kac@post.cz
%   Date:   posted February 2001, updated June 2006.
%
if nargin<4, decdigs=10; end
if nargin<3
   warning ('Error in input format')
else
   rom=zeros(2,decdigs);
   romall=zeros(1,(2^(decdigs-1))+1);   
   romall=feval(funfcn,a:(b-a)/2^(decdigs-1):b,varargin{:});
   h=b-a;
   rom(1,1)=h*(romall(1)+romall(end))/2;
   for i=2:decdigs
      st=2^(decdigs-i+1);
      rom(2,1)=(rom(1,1)+h*sum(romall((st/2)+1:st:2^(decdigs-1))))/2;
      for k=1:i-1
         rom(2,k+1)=((4^k)*rom(2,k)-rom(1,k))/((4^k)-1);
      end
      rom(1,1:i)=rom(2,1:i);
      h=h/2;
   end
   res=rom(1,decdigs);
end

matlab/VB/python/c++/Java写程序请发QQ邮件:790404545@qq.com
2楼2013-01-10 16:56:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见