| 查看: 2702 | 回复: 19 | |||
[交流]
【求助】feval的使用
|
|
现在在看《数值分析导论》韩渭敏译,379页中的边值问题, 在对这个偏微分方程的求解过程中用到一条语句 feval(f,(1:n-1)*h,(1:n-1)*h) 注释中说明f方程的右边的函数值,我不知道如何写这个f的m函数,有人可以指点一下啊 |
» 猜你喜欢
越来越担心硕士毕业后没有竞争力了
已经有12人回复
闲聊
已经有6人回复
申博求助
已经有4人回复
» 抢金币啦!回帖就可以得到:
坐标上海,诚征结婚对象
+1/973
大连理工大学化学学院 招2027博士 MOFs、COFs、催化和分离方向博士生
+1/84
坐标北京 互联网行业,计算机专业,90后178男子,找女友。
+1/83
海南大学化学化工学院光激励功能材料团队招收2027年博士生
+1/81
静电纺丝膜厚度问题
+1/75
南开大学环境科学与工程学院 环境与人体健康方向 招博士研究生、硕士研究生各1名
+1/71
哈尔滨工业大学招收博士研究生(欢迎环境、生物、市政、农业、化学等专业)长期有效
+1/41
北京师范大学吴老师招收申请考核制 2027级学术博士生(环境/遥感/人工智能方向等)
+1/33
浙大许军课题组招聘
+1/23
【交流】科技成果评价简要流程,新手参考
+1/8
清华大学深圳国际研究生院-智慧健康建筑实验室-2027年博士招生
+1/7
中科大 冯伟 课题组招生-电化学 电池
+1/7
招聘光电方向博士后、讲师和副教授
+1/6
招聘光电方向博士后、讲师和副教授
+1/5
您身边的科研非标定制专家--赛思睿
+1/4
海南大学招收2027级博士/博士后
+1/3
东南大学招收博士研究生
+1/2
海南大学招收2027级博士/博士后
+1/1
Luminex多重细胞因子检测:技术原理、性能优势与应用场景
+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










回复此楼