⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simp0.mht

📁 it is a very essential matlab code.
💻 MHT
字号:
From: <Saved by Windows Internet Explorer 7>
Subject: 
Date: Tue, 12 May 2009 09:51:54 -0700
MIME-Version: 1.0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/simp0.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.6000.16825" name=3DGENERATOR></HEAD>
<BODY><PRE>function q =3D simp0(y,h);
% function simp0(y,h);     Simpson's 1/3 quadrature rule - non-vector =
version
%
%   input: y - function vector to be integrated
%          h - interval width
%  output: integral in the given region

n =3D length(y);             % number of data points
if (n/2) =3D=3D floor(n/2)     % check to see if even (don't want this!)
  fprintf('\nError: must have odd number of data points\n');
  break;
end

summat =3D 0;
for i =3D 2:2:n-1
  summat =3D summat + 4 * y(i);
end
for i =3D 3:2:n-2
  summat =3D summat + 2 * y(i);
end
summat =3D summat + y(1) + y(n);

q =3D summat * h/3;  </PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -