52matlab技术网站,matlab教程,matlab安装教程,matlab下载

标题: 对流-扩散-反应方程的Runge-Kutta-Chebyshev算法 [打印本页]

作者: matlab的旋律    时间: 2017-11-24 18:08
标题: 对流-扩散-反应方程的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=[0 1];
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;
[w,t]=rkc1(f,tspan,tol,w0',s,x');
cputime_t = cputime - t_start;

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







欢迎光临 52matlab技术网站,matlab教程,matlab安装教程,matlab下载 (http://www.52matlab.com/) Powered by Discuz! X3.2