| 查看: 2203 | 回复: 19 | |||
[交流]
【求助】feval的使用
|
|
现在在看《数值分析导论》韩渭敏译,379页中的边值问题, 在对这个偏微分方程的求解过程中用到一条语句 feval(f,(1:n-1)*h,(1:n-1)*h) 注释中说明f方程的右边的函数值,我不知道如何写这个f的m函数,有人可以指点一下啊 |
» 猜你喜欢
材料/农业专业,07/08开头均可,过线就行
已经有4人回复
327求调剂
已经有5人回复
361求调剂
已经有3人回复
一志愿中南大学化学学硕0703总分337求调剂
已经有5人回复
一志愿北京化工大学 070300 学硕 336分 求调剂
已经有6人回复
材料专业求调剂
已经有10人回复
341求调剂(一志愿湖南大学070300)
已经有5人回复
0854 考研调剂 招生了!AI 方向
已经有15人回复
384求调剂
已经有6人回复
生物学学硕求调剂
已经有4人回复
» 抢金币啦!回帖就可以得到:
基金祈福
+3/1736
北京-89175-事业单位-诚征女友
+1/94
华南理工-广中医联合招收生物医学与材料交叉学科博士生
+1/82
散金币,求基金中标!!
+1/60
【全额奖学金+英国博士学位】国科大杭高院Nathan课题组招收2026级联培博士生1名!
+1/49
吲哚美辛原料药合成交流
+1/34
刚刚工作不久的孤独感
+1/33
上海交大化院功能大分子团队招2026年硕士、联培、博士后
+1/31
浙江大学光电学院极端光学技术与仪器国家重点实验室诚聘极紫外阿秒方向博士后
+1/26
双一流大学湘潭大学“化工过程模拟与强化”国家地方联合工程研究中心招收各类博士生
+1/20
中国地质大学(武汉)清洁能源与资源循环团队诚招科研助理/2026级硕士、博士生/博士后
+1/16
招收从事大气复合污染成因领域研究生
+1/14
哈尔滨工业大学(深圳)国家级青年人才机械工程、热能与能源等专业26年入学博士招生
+1/7
福建师范大学环境与资源学院招收2026级硕士生
+1/5
丽水学院 资源与环境专业 硕士招生/调剂
+1/3
香港中文大学化学系吴基培教授招募2026年秋季(2026年8月1日)入学全奖博士研究生
+1/2
浙江大学高纯分离团队诚聘博士后
+1/1
26申博自荐
+1/1
上海高校交通运输工程专业环境方向接收数一调剂
+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













回复此楼