| 查看: 2376 | 回复: 19 | |||
[交流]
【求助】feval的使用
|
|
现在在看《数值分析导论》韩渭敏译,379页中的边值问题, 在对这个偏微分方程的求解过程中用到一条语句 feval(f,(1:n-1)*h,(1:n-1)*h) 注释中说明f方程的右边的函数值,我不知道如何写这个f的m函数,有人可以指点一下啊 |
» 猜你喜欢
宿州学院学报
已经有5人回复
青B发送上会通知了吗
已经有14人回复
博士申请
已经有5人回复
4,4二甲基联苯干啥用,有懂得吗
已经有4人回复
西安交大新媒学院副院长用撤稿论文结题
已经有7人回复
论文撤稿了
已经有9人回复
化学专业申博
已经有5人回复
招收2026级博士生
已经有5人回复
医学类期刊求推荐
已经有6人回复
26/27申博自荐
已经有10人回复
» 抢金币啦!回帖就可以得到:
公众号有偿招募推文
+1/476
山东征女友,坐标济南
+1/172
华南师范大学海洋环境科学课题组招聘青年英才和博士后
+2/134
【专业EPR】:自由基(超氧、羟基、单线态氧),空位缺陷;定量计算,VX: 761711562。
+1/89
中科院二区期刊Gels 组稿
+1/81
江苏大学优青 胡兴好教授课题组博士后招聘
+1/81
坐标广州
+2/40
【通知】北京信息科技大学仪器科学与光电工程学院招收博士研究生(2026)
+2/30
安徽大学俞洋洋课题组招收化学方向博士生1人
+1/28
安徽农业大学招聘师资博士后以及人才引进教师
+1/24
【20260528】湖南工业大学许利剑教授招收2026级生物医学工程博士研究生
+1/21
南京农业大学2026年申请考核制博士招生:最后一批啦!
+1/8
材料分析测试
+1/8
电子科技大学材料学院SFT创新中心招收准备考研和读博的科研助理 理工医交叉方向
+1/8
紧急招收2026年秋季入学博士生1名(河北工大/北京科技大学联合 增材制造/生物材料)
+1/5
电子科技大学材料学院SFT创新中心招收准备考硕和读博的科研助理 理工医交叉方向
+1/5
【通知】北京信息科技大学仪器科学与光电工程学院招收博士研究生(2026),报名吧!
+1/5
北理工国家杰青团队招博士后
+1/4
【通知】北京信息科技大学仪器科学与光电工程学院招收博士研究生(2026),还有名额!
+1/3
易度质量流量计在微孔加工流通性测试中的应用
+1/1
2楼2011-01-07 20:04:38
3楼2011-01-07 21:47:10
4楼2011-01-08 10:12:37
5楼2011-01-08 10:28:14
|
>> Poisson('f','g',16,1e-8,10000) Warning: Could not find an exact (case-sensitive) match for 'Poisson'. C:\Documents and Settings\lenovo\My Documents\MATLAB\poisson.m is a case-insensitive match and will be used instead. You can improve the performance of your code by using exact name matches and we therefore recommend that you update your usage accordingly. Alternatively, you can disable this warning using warning('off','MATLAB:dispatcher:InexactCaseMatch'). This warning will become an error in future releases. ??? Error using ==> mtimes Inner matrix dimensions must agree. Error in ==> f at 2 f=-2*pi^2*sin(pi*x)*sin(pi*y); Error in ==> poisson at 13 Fr(2:n,2:n)=h^2*feval(f,(1:n-1)*h,(1:n-1)*h); 错误的提示 |
6楼2011-01-08 10:51:59
7楼2011-01-08 10:57:32
8楼2011-01-08 11:04:41
|
function U=poisson(f,g,n,tol,max_it) if nargin<5 max_it=10000 end if nargin<4 tol=1e-5 end n1=n+1; h=1/n; toln=(h^2)*tol; Fr=zeros(n,n); Fr(2:n,2:n)=h^2*feval(f,(1:n-1)*h,(1:n-1)*h); U=zeros(n1,n1); U(1,1:n1)=feval(g,0,(0:n)*h); U(n1,1:n1)=feval(g,1,(0:n)*h); U(1:n1,1)=feval(g,(0:n)*h,0); U(1:n1,n1)=feval(g,(0:n)*h,1); rel_err=1; itnum=0; while((rel_err>toln)&(itnum<=max_it)) err=0; umax=0; for j=2:n for i=2:n temp=(U(i+1,j)+U(i-1,j)+U(i,j+1)+U(i,j-1))/4-Fr(i,j); dif=abs(temp-u(i,j)); if(err<=diff) err=dif; end U(i,j)=temp; temp=abs(temp); if(umax<=temp) umax=temp; end end end itnum=itnum+1; rel_err=err/umax; end %X=(0:h,:n*h)'; %Y=X; %surf(X,Y,U') %xlabel('x-axis') %ylabel('y-axis') %zlabel('the numerical solution') %title('Plot of the mumerical solution') X=(0:h:n*h)';Y=X; subplot(1,2,1) surf(X,Y,U') xlabel('x-axis') ylabel('y-axis') zlabel('The numerical solution') s1=springtf('h=6.4f',h) title(s1) hold on Err=sin(pi*X)*sin(pi*Y')-U; subplot(1,2,2) surf(X,Y,Err') |
9楼2011-01-08 11:05:13
10楼2011-01-08 11:06:14
11楼2011-01-08 11:06:47
12楼2011-01-08 11:09:33
13楼2011-01-08 11:34:09
14楼2011-01-08 11:48:22
15楼2011-01-08 11:53:22
16楼2011-01-08 12:03:07
17楼2011-01-08 13:37:10
18楼2011-01-08 14:13:18
19楼2011-01-08 14:32:43
20楼2011-01-08 15:21:26












回复此楼