Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#4 |
初级会员
注册日期: 2008-04-08
年龄: 40
帖子: 5
声望力: 0 ![]() |
![]()
付给初始值的函数: adiab.m
epsilon = 1; % Allowable error in temerature (K) max_iteration = 20; % Maximum number of iterations to convergence step = 10; % for saving values in var, dvar matrices dtheta = 1; % integration increment (radians) % Initial conditions: y(the) = th; y(tck) = tk; y(te) = th; y(tc) = tk; iter = 0; terror = 10*epsilon; % Initial error to enter the loop % Iteration loop to cyclic convergence while ((terror >= epsilon)&(iter < max_iteration)) % cyclic initial conditions tc0 = y(tc); te0 = y(te); theta = 0; y(qk) = 0; y(qr) = 0; y(qh) = 0; y(wc) = 0; y(we) = 0; y(w) = 0; fprintf('iteration %d: tc = %.1f[K], te = %.1f[K]\n',iter,y(tc),y(te)) for(i = 1:1:360) [theta,y,dy] = rk4('dadiab',7,theta,dtheta,y); end terror = abs(tc0 - y(tc)) + abs(te0 - y(te)); iter = iter + 1; end if (iter >= max_iteration) fprintf('No convergence within %d iteration\n',max_iteration) end for(j = 1:1:10) [theta,y,dy] = rk4('dadiab',7,theta,dtheta,y); end |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]求助高手!!用MATLAB制作动画 | shingo | MATLAB论坛 | 1 | 2008-05-11 08:33 |
【求助】彩色图像转化成灰度图像出现的问题 | tcamel | MATLAB论坛 | 7 | 2008-05-03 01:25 |
[求助]GUI中控件如何编写回调程序 | lg861219 | MATLAB论坛 | 4 | 2008-04-12 21:01 |
【文章】**Matlab中下标及希腊字母的使用方法** | spy1120 | MATLAB论坛 | 3 | 2008-01-22 14:37 |
【求助】求人指导matlab在dsp上的应用 | 天天天下 | MATLAB论坛 | 2 | 2008-01-01 11:08 |