Matlab adaptive quadrature
- % script to perform adaptive quadrature
- clear all, close all
- global pts
- % function to be integrated defined in routine f
- f = 'integrand';
- a = 1; b = 3;
- pts = [a;b];
- tol = input('Enter error tolerance: ');
- % this is just to plot the graph
- % it's usually a good idea to look at the integrand
- % if possible before you try to integrate it
- ezplot(f,[1,3])
- disp('Hit any key to continue')
- pause
- hold on
- fa = feval(f,a);
- fb = feval(f,b);
- Sf_old = simp(a,b,f,fa,fb);
- Sf = adaptiveSimpson(a,b,f,fa,fb,tol,Sf_old)
- qpts = sort(pts);
- plot(qpts,zeros(length(pts),1),'rx')
- disp('number of function evaluations')
- disp(length(pts))
- disp('Hit any key to continue')
- pause
- % now compare result with straight Simpson's rule
- % using the same number of points
- sum = 0;
- h = (b-a)/(length(pts)-1);
- for i=0:length(pts)-1,
- fxi = feval(f,a+i*h);
- if i == 0 | i == length(pts)-1,
- sum = sum + fxi;
- elseif mod(i,2) == 1,
- sum = sum + 4*fxi;
- else
- sum = sum + 2*fxi;
- end
- end
- disp('Simpson''s rule with the same number of points')
- sum = h/3*sum
- % compute exact solution
- % anti-derivative of integrand is 10*cos(10/x)
- % so ...
- exactSolution = 10*(cos(10/b)-cos(10/a));
- errorAdaptiveSimpson = exactSolution - Sf
- errorUniformSimpson = exactSolution - sum
Matlab adaptive quadrature的更多相关文章
- Matlab Gauss quadrature
% matlab script to demonstrate use of Gauss quadrature clear all close all % first derive the 2-poin ...
- <<Numerical Analysis>>笔记
2ed, by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is l ...
- <Numerical Analysis>(by Timothy Sauer) Notes
2ed, by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is l ...
- 限制对比度自适应直方图均衡(Contrast Limited Adaptive histgram equalization/CLAHE)
转自:http://www.cnblogs.com/Imageshop/archive/2013/04/07/3006334.html 一.自适应直方图均衡化(Adaptive histgram eq ...
- Matlab小波工具箱的使用2
Matlab小波工具箱的使用2 (2011-11-11 09:32:57) 转载▼ http://blog.sina.com.cn/s/blog_6163bdeb0102dw7a.html#cmt_5 ...
- 数字图像处理的Matlab实现(4)—灰度变换与空间滤波
第3章 灰度变换与空间滤波(2) 3.3 直方图处理与函数绘图 基于从图像亮度直方图中提取的信息的亮度变换函数,在诸如增强.压缩.分割.描述等方面的图像处理中扮演着基础性的角色.本节的重点在于获取.绘 ...
- Paper | Contrast Limited Adaptive Histogram Equalization
目录 1. 背景 1.1. 对比度和直方图均衡HE 1.2. HE的问题 1.3. AHE 1.4. 底噪问题 2. CLAHE 2.1. 效果展示 2.2. 算法格式和细节 论文:Contrast ...
- Gauss-Laguerre quadrature rule
% matlab script to derive the 2-point Gauss-Laguerre quadrature rule % and use it on an example % in ...
- MATLAB数值积分法
MATLAB数值积分法 作者:凯鲁嘎吉 - 博客园http://www.cnblogs.com/kailugaji/ 一.实验目的 许多工程技术和数学研究中要用到定积分,如果无法直接算不出精确值(如含 ...
随机推荐
- DL_1_week1_概论
standard NN,CNN,RNN,custom hybrid NN architecture(Radar) 结构化数据是数据的数据库,相比结构化数据计算机更难理解非结构化数据,人生来很容易理解非 ...
- javabean的特点
javabean的三个基础条件 1.拥有私有的属性 2.共有的get,set方法 3.默认的构造方法
- 基于dsp_builder的算法在FPGA上的实现(转自https://www.cnblogs.com/sunev/archive/2012/11/17/2774836.html)
一.摘要 结合dsp_builder.matlab.modelsim和quartus ii等软件完成算法的FPGA实现. 二.实验平台 硬件平台:DIY_DE2 软件平台:quartus ii9.0 ...
- @WebFilter怎么控制多个filter的执行顺序
转自:http://blog.csdn.net/liming_0820/article/details/53332070 之前我们控制多个filter的执行顺序是通过web.xml中控制filter的 ...
- 关于调试WCF时引发的异常XmlException: Name cannot begin with the '<' character, hexadecimal value 0x3C” on Client Side
问题描述:在使用VS2015调试WCF时,偶遇抛出异常名称不能以“<”字符(十六进制0x3c)开头,平时运行时(不调试)没有问题的. 解决方法:检查后发现为了检查异常的位置,勾选了引发通用语言运 ...
- Container Adaptors
Notes from C++ Primer stack and queue: based on deque priority_queue: based on vector Standard li ...
- Eclipse 中 SVN 插件的安装与使用
下载和安装SVN插件 插件在线安装 可以选择在线安装插件的方式,就是使用eclipse里Help菜单的“Install New Software”,通过输入SVN地址,直接下载安装到eclipse里. ...
- process(进程)
进程 指的是执行中程序的一个实例(instance). 新进程由fork() 与 execve() 等系统调用起始,然后执行,直到下达exit()系统调用为止. 操作系统内核里,称为调度器(sched ...
- Restore database use sql `*.bak` file
1.第一步: 2.第二步: 3.第三布: 4.第四步:
- vue-cli3 DllPlugin 提取公用库
vue 开发过程中,保存一次就会编译一次,如果能够减少编译的时间,哪怕是一丁点,也能节省不少时间.开发过程中个人编写的源文件才会频繁变动,而一些库文件我们一般是不会去改动的.如果能把这些库文件提取出来 ...