matlab的旋律 发表于 2017-11-24 18:08:42

对流-扩散-反应方程的Runge-Kutta-Chebyshev算法

matlab脚本函数内容如下:

clear all
close all
clc

global f_cout
f_cout = 0;

t_start = cputime;
%
% Discretize in space
%
% m is the number of segments in x-axis
m=100;
xs=;
mk=m+1;

% x is a vector that contains the value of points in x axis
x=linspace(xs(1),xs(2),mk);
%

% Give the initial value
%        w0 is a vector that contains the initial value of w
w0=sin(x);

%        w0(1)=0 and w0(mk)=0 are boundary conditions
w0(mk)=0;

f = 'F';
tspan = linspace(0,0.5,mk);
tol = 1e-6;
s = 4;
=rkc1(f,tspan,tol,w0',s,x');
cputime_t = cputime - t_start;

disp(['cpu时间:',num2str(cputime_t),'s'])
disp(['F赋值次数',num2str(f_cout)])


页: [1]
查看完整版本: 对流-扩散-反应方程的Runge-Kutta-Chebyshev算法