e891.m
来自「matlab算法集 matlab算法集」· M 代码 · 共 31 行
M
31 行
%-----------------------------------------------------------------------
% Example 8.9.1: Chemical Reactor
%-----------------------------------------------------------------------
% Initialize
clc % clear screen
clear % clear variables
n = 3; % dimension of system
m = 100; % number of solution points
q = 5000; % maximum function evaluations
alpha = 0; % initial time
beta = 1.2; % final time
tol = 1.e-6; % error bound
x0 = [5 3 0]'; % initial state
% Solve equations
fprintf ('Example 8.9.1: Chemical Reactor\n');
[t,X,e,k] = rkf (x0,alpha,beta,m,tol,q,'funf891');
% Display results
show ('Number of scalar function evaluations',k);
show ('Maximum truncation error',e);
show ('Final product concentration (moles/m^3)',X(m,n));
graphxy (t,X,'Concentrations','t (min)','x(t) (moles/m^3)')
%-----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?