| 查看: 2456 | 回复: 19 | |||
[交流]
【求助】feval的使用
|
|
现在在看《数值分析导论》韩渭敏译,379页中的边值问题, 在对这个偏微分方程的求解过程中用到一条语句 feval(f,(1:n-1)*h,(1:n-1)*h) 注释中说明f方程的右边的函数值,我不知道如何写这个f的m函数,有人可以指点一下啊 |
» 猜你喜欢
面上再次挂了,太难了,躺也躺不了,倦也卷不过,小学校之殇!
已经有22人回复
2026年国自然面上资助率
已经有19人回复
微信指数没变化,科研之友没阅读
已经有18人回复
基础研究怎么拉横向,学校到款任务越来越多,难以完成 拉横向,都有哪些途径啊
已经有8人回复
HXDI做水性聚氨酯乳液,是不是特别容易出渣
已经有3人回复
系统今天又提示维护了,估计离放榜不远了
已经有15人回复
你们的时间戳变了吗
已经有4人回复
今年的WR进展到哪一步了?
已经有9人回复
产物和副产物价值比较
已经有5人回复
时间戳他又来了
已经有17人回复
» 抢金币啦!回帖就可以得到:
2027年博士生(硕博连读/直博)吉林大学-苏州国家实验室光电半导体智能设计与应用团队
+1/476
坐标北京,92男,诚征结婚对象
+1/169
实验室用简易工装、夹具、模具、测试板
+1/82
山东第一医科大学医工交叉团队2025年招收纳米医学、药物化学等领域副教授、博士后
+1/73
Postdoctoral fellow in Medicinal Chemistry, McGill University
+1/71
Postdoctoral fellow in Medicinal Chemistry, McGill University
+1/71
西湖大学拓扑光学、非厄米光学、太赫兹方向博士后招聘(长期有效)
+5/35
有机合成高级研究员
+1/32
中国特种设备检测研究院招聘1名高温涂层方向博士后
+2/30
大连理工大学化学学院界面介导黏附与组装课题组招收推免生
+1/27
深圳大学 招收2027级推免研究生 (金属材料/ 3D打印/ 氢能等方向)
+1/24
诚征女友( 西安 )
+1/22
新西兰坎特伯雷大学招博士后
+1/6
西安交通大学补亚忠课题组招收申请考核制博士生
+2/6
北京师范大学(珠海校区)赵亚然副教授招收2027年电催化推免硕士/博士研究生
+1/6
多本Scopus收录国际英文期刊征稿,全免 APC!含医学期刊
+1/5
(Scopus期刊)Biofunctional Materials《生物功能性材料》招募青年编委及征稿
+1/4
国际 EI 会议征稿进行时
+1/2
中科院大连化物所诚聘博士后/科研助理/项目聘用人员
+1/1
有没有管理类博士招生
+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










回复此楼