|
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
|