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

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3356|回复: 0
打印 上一主题 下一主题

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

[复制链接]

123

主题

207

帖子

2992

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2992
跳转到指定楼层
楼主
发表于 2017-11-24 18:08:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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)])


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|52matlab技术网站 ( 粤ICP备14005920号-5 )

GMT+8, 2024-4-19 11:13 , Processed in 0.087174 second(s), 20 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表