資源簡介
構造偏微分方程差分格式,對其弱形式進行網格剖分,用matlab對其進行求解

代碼片段和文件信息
function?y=f(n)
h=pi/n;
x=zeros(1n-1);
for?i=1:n-1
????x(i)=-pi/2+i*h;
end
f=cos(x);
f=f‘;
A=zeros(n-1n-1)
for?i1=1:n-1
????A(i1i1)=-h^2-2
end
for?i2=1:n-2
????A(i2i2+1)=1;
????A(i2+1i2)=1;
end
A=(-1/(2*h^2))*A
f
u=A\f
plot(xu‘r*‘)
hold?on
ut=cos(x)
plot(xut‘gd‘)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????47792??2015-11-10?08:49??用差分方法求微分方程的數值解.doc
?????文件?????????294??2015-11-10?08:47??f.m
評論
共有 條評論