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/ 一.实验目的 许多工程技术和数学研究中要用到定积分,如果无法直接算不出精确值(如含 ...
随机推荐
- Html5与Css3知识点拾遗(六)
web字号 px() 百分比(较常用) em(最常用):一般1em=16px,相对单位.以父元素作参照系,父元素大小是不确定的 body{ font-size:100%; /*父元素默认为16px*/ ...
- Alpha冲刺 - (5/10)
Part.1 开篇 队名:彳艮彳亍团队 组长博客:戳我进入 作业博客:班级博客本次作业的链接 Part.2 成员汇报 过去两天完成了哪些任务 基于ssm框架的前后端交互测试,结合微信小程序demo 展 ...
- 推荐使用OpenLiveWriter在cnblogs上写的Blog
这是我第一个使用OpenLiveWriter在cnblogs上写的Blog.不知道效果如何,但又很多功能我可以采用! 如表格功能: Open Live Writer Write on Web 优 ...
- PB窗口根据分辨率的大小调整窗口大小
//来自:http://topic.csdn.net/u/20070105/09/88f3c417-6882-4e26-b622-0f9a0a9a65e0.html //给你个通用函数,在窗口的OPE ...
- Django Admin 专题
Django admin Django强大的功能之一就是提供了Admin后台管理界面,简单配置就可以对数据库内容做管理 创建ModelAdmin并注册 from django.contrib impo ...
- open:在终端打开文件|应用程序等
1. 需求&解决方案 打开文件 或url(用默认应用程序): $ open fileName 打开文件 或url(用指定应用程序): $ open -a appName fileName ## ...
- .net core mvc发布项目到IIS上出现500错误
如题,我把.net core mvc项目以应用程序方式挂到IIS默认网站下,结果出现了如下错误:HTTP Error 500.0 - ANCM In-Process Handler Load Fail ...
- WebRTC学习之 Intel® Collaboration Suite for WebRTC源码流程解读
年后回来,因为新项目的需求,开始了解WebRTC相关的知识.目前接触的是Intel® Collaboration Suite for WebRTC.刚开始看SDK发现很多概念是我目前不知道的,于是恶补 ...
- 记一次sentry部署过程
本文记录下部署sentry和其中遇到的问题 Sentry 是一款基于 Django实现的错误日志收集和聚合的平台,它是 Python 实现的,但是其日志监控功能却不局限于python,对诸如 Node ...
- MapReduce对交易日志进行排序的Demo(MR的二次排序)
1.日志源文件 (各个列分别是: 账户,营业额,花费,日期) zhangsan@163.com 6000 0 2014-02-20 lisi@163.com 2000 0 2014-02-20 lis ...