偏微分方程数值解实验报告.docx

上传人:b****1 文档编号:133230 上传时间:2022-10-04 格式:DOCX 页数:18 大小:209.38KB
下载 相关 举报
偏微分方程数值解实验报告.docx_第1页
第1页 / 共18页
偏微分方程数值解实验报告.docx_第2页
第2页 / 共18页
偏微分方程数值解实验报告.docx_第3页
第3页 / 共18页
偏微分方程数值解实验报告.docx_第4页
第4页 / 共18页
偏微分方程数值解实验报告.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

偏微分方程数值解实验报告.docx

《偏微分方程数值解实验报告.docx》由会员分享,可在线阅读,更多相关《偏微分方程数值解实验报告.docx(18页珍藏版)》请在冰豆网上搜索。

偏微分方程数值解实验报告.docx

偏微分方程数值解实验报告

一、题目:

1、用有限元方法求下列边值问题的数值解:

其中其精确解为,取h=0.1

要求:

(1)将精确解与用有限元得到的数值解画在同一图中

(2)、、

2、用线性元求解下列问题的数值解:

精确到小数点后第六位,并画出解曲面。

3、用Crank-Nicolson差分法求解Burger方程

其中取要求画出解曲面。

迭代格式如下:

二、代码:

1、

%RitzGalerkin方法求解方程

functionu1=Ritz(x)

%定义步长

h=1/100;

x=0:

h:

1;

n=1/h;

a=zeros(n-1,1);

b=zeros(n,1);

c=zeros(n-1,1);

d=zeros(n,1);

%求解Ritz方法中内点系数矩阵

fori=1:

1:

n-1

b(i)=(1/h+h*pi*pi/12)*2;

d(i)=h*pi*pi/2*sin(pi/2*(x(i)+h))/2+h*pi*pi/2*sin(pi/2*x(i+1))/2;

end

%右侧导数条件边界点的计算

b(n)=(1/h+h*pi*pi/12);

d(n)=h*pi*pi/2*sin(pi/2*(x(i)+h))/2;

fori=1:

1:

n-1

a(i)=-1/h+h*pi*pi/24;

c(i)=-1/h+h*pi*pi/24;

end

%调用追赶法

u=yy(a,b,c,d)

%得到数值解向量

u1=[0,u]

%对分段区间做图

plot(x,u1)

%得到解析解

y1=sin(pi/2*x);

holdon

plot(x,y1,'o')

legend('数值解','解析解')

functionx=yy(a,b,c,d)

n=length(b);

q=zeros(n,1);

p=zeros(n,1);

q

(1)=b

(1);

p

(1)=d

(1);

fori=2:

1:

n

q(i)=b(i)-a(i-1)*c(i-1)/q(i-1);

p(i)=d(i)-p(i-1)*c(i-1)/q(i-1);

end

x(n)=p(n)/q(n);

forj=n-1:

-1:

1

x(j)=(p(j)-a(j)*x(j+1))/q(j);

end

x

x=

Columns1through11

0.01570.03140.04710.06280.07850.09410.10970.12530.14090.15640.1719

Columns12through22

0.18740.20280.21810.23350.24870.26390.27900.29400.30900.32390.3387

Columns23through33

0.35350.36810.38270.39720.41150.42580.44000.45400.46790.48180.4955

Columns34through44

0.50910.52250.53580.54900.56210.57500.58780.60040.61290.62530.6374

Columns45through55

0.64950.66130.67300.68460.69590.70710.71810.72900.73970.75010.7604

Columns56through66

0.77050.78050.79020.79970.80900.81820.82710.83580.84440.85270.8608

Columns67through77

0.86870.87630.88380.89100.89810.90490.91140.91780.92390.92980.9355

Columns78through88

0.94090.94610.95110.95580.96030.96460.96860.97240.97590.97930.9823

Columns89through99

0.98510.98770.99010.99210.99400.99560.99690.99810.99890.99950.9999

Column100

1.0000

u=

Columns1through11

0.01570.03140.04710.06280.07850.09410.10970.12530.14090.15640.1719

Columns12through22

0.18740.20280.21810.23350.24870.26390.27900.29400.30900.32390.3387

Columns23through33

0.35350.36810.38270.39720.41150.42580.44000.45400.46790.48180.4955

Columns34through44

0.50910.52250.53580.54900.56210.57500.58780.60040.61290.62530.6374

Columns45through55

0.64950.66130.67300.68460.69590.70710.71810.72900.73970.75010.7604

Columns56through66

0.77050.78050.79020.79970.80900.81820.82710.83580.84440.85270.8608

Columns67through77

0.86870.87630.88380.89100.89810.90490.91140.91780.92390.92980.9355

Columns78through88

0.94090.94610.95110.95580.96030.96460.96860.97240.97590.97930.9823

Columns89through99

0.98510.98770.99010.99210.99400.99560.99690.99810.99890.99950.9999

Column100

1.0000

u1=

Columns1through11

00.01570.03140.04710.06280.07850.09410.10970.12530.14090.1564

Columns12through22

0.17190.18740.20280.21810.23350.24870.26390.27900.29400.30900.3239

Columns23through33

0.33870.35350.36810.38270.39720.41150.42580.44000.45400.46790.4818

Columns34through44

0.49550.50910.52250.53580.54900.56210.57500.58780.60040.61290.6253

Columns45through55

0.63740.64950.66130.67300.68460.69590.70710.71810.72900.73970.7501

Columns56through66

0.76040.77050.78050.79020.79970.80900.81820.82710.83580.84440.8527

Columns67through77

0.86080.86870.87630.88380.89100.89810.90490.91140.91780.92390.9298

Columns78through88

0.93550.94090.94610.95110.95580.96030.96460.96860.97240.97590.9793

Columns89through99

0.98230.98510.98770.99010.99210.99400.99560.99690.99810.99890.9

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 初中作文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1