| 查看: 2248 | 回复: 19 | |||
[交流]
【求助】feval的使用
|
|
现在在看《数值分析导论》韩渭敏译,379页中的边值问题, 在对这个偏微分方程的求解过程中用到一条语句 feval(f,(1:n-1)*h,(1:n-1)*h) 注释中说明f方程的右边的函数值,我不知道如何写这个f的m函数,有人可以指点一下啊 |
» 猜你喜欢
310求调剂
已经有6人回复
面上5B能上会吗?
已经有5人回复
279求调剂
已经有3人回复
材料与化工272求调剂
已经有17人回复
材料工程专硕求调剂
已经有3人回复
337求调剂
已经有5人回复
材料与化工328分调剂
已经有9人回复
318一志愿吉林大学生物与医药 求调剂
已经有5人回复
一志愿南开大学0710生物学359求调剂
已经有4人回复
求调剂
已经有6人回复
» 抢金币啦!回帖就可以得到:
东莞理工土木工程和土木水利专业硕士接受调剂,名额充足!
+1/91
中科院三区,审稿速度快,期刊Journal of Groundwater Science and Engineering
+1/88
焊接专业应届毕业生招聘
+1/81
欢迎报考赣南师范大学智能制造与未来能源学院
+2/52
留学--博士招生
+1/50
中山大学地理科学与规划学院退化土壤环境修复课题组招聘博士后及科研助理
+1/41
招收材料相关硕士研究生
+2/40
2026延安大学设施蔬菜环境调控与分子机制研究团队团队招收相关专业调剂研究生
+1/39
福建农林大学材料院招收调剂硕士生
+1/37
武汉工程大学化学与环境工程学院 2026 年硕士研究生调剂公告
+1/10
北京某研究院结构生物学相关专业接收调剂研究生
+1/8
江西科技师范大学 材料与能源招收调剂研究生
+1/7
武汉工程大学化学与环境工程学院招收调剂生
+1/6
广东医科大学 李雪萌教授团队 招收申请考核制博士(临床检验诊断)
+1/5
中国科学院大学纳米科学与技术学院-罗聃课题组诚招硕士研究生
+1/4
【水文、水质模拟】香港科技大学(广州)博士后招聘
+1/4
齐齐哈尔大学化学与化学工程学院诚招专硕
+1/4
各种IgG抗体表达系统
+1/3
中科院科研助理招聘
+1/2
武汉理工大学船海与能源动力工程学院刘鹏飞院士团队博士后招聘启事
+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














回复此楼