Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2009-12-26, 15:01   #1
zhaolei1987
初级会员
 
注册日期: 2009-12-26
年龄: 37
帖子: 5
声望力: 0
zhaolei1987 正向着好的方向发展
微笑 求一道编程

用Jacobi迭代法计算如下方程组
10a-b-2c=72
-a+10b-2c=83
-a-b+5c=42

请教高手来写一段程序求解方程组,非常之感谢
zhaolei1987 当前离线   回复时引用此帖
旧 2009-12-27, 16:25   #2
sogeno
初级会员
 
注册日期: 2009-04-10
住址: nuaa
年龄: 40
帖子: 20
声望力: 17
sogeno 正向着好的方向发展
默认 回复: 求一道编程

也请楼主得到后发给我一份,非常之感谢
__________________
i ilove inter millan
sogeno 当前离线   回复时引用此帖
旧 2009-12-28, 12:21   #3
zhaolei1987
初级会员
 
注册日期: 2009-12-26
年龄: 37
帖子: 5
声望力: 0
zhaolei1987 正向着好的方向发展
默认 回复: 求一道编程

jacobi迭代法

h0=figure('toolbar','none',...
'position',[200 150 450 250],...
'name','实例93');
h1=axes('parent',h0,...
'position',[0.05 0.15 0.65 0.6],...
'visible','off');
I=imread('abmatrix.bmp','bmp');
image(I)
axis off
huidiao=[...
'a=[1 0 3 0;0 2 1 2;3 1 15 0;0 2 0 4;];,',...
'b=[1 6 5 8]'';,',...
'n=4;,',...
'u=zeros(n,1);,',...
'tic,',...
'[x,k]=jac(a,b,n,u);,',...
'time1=toc;,',...
'T=num2str(time1);,',...
'set(e1,''string'',[T,''秒'']);,',...
'set(e2,''string'',num2str(k));,',...
'msgbox([''X=['',num2str(x(1)),'' '',num2str(x(2)),'' '',num2str(x(3)),'','',num2str(x(4)),'']''],''方程组的解'');'];
t1=uicontrol('parent',h0,...
'units','points',...
'tag','t1',...
'style','text',...
'string','方程组如下:',...
'fontsize',15,...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[20 150 100 20]);
e1=uicontrol('parent',h0,...
'units','points',...
'tag','e1',...
'style','edit',...
'horizontalalignment','right',...
'backgroundcolor',[1 1 1],...
'position',[295 130 35 20]);
t2=uicontrol('parent',h0,...
'units','points',...
'tag','t2',...
'style','text',...
'string','计算时间:',...
'fontsize',10,...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[240 130 50 20]);
e2=uicontrol('parent',h0,...
'units','points',...
'tag','e2',...
'style','edit',...
'horizontalalignment','right',...
'backgroundcolor',[1 1 1],...
'position',[295 100 35 20]);
t2=uicontrol('parent',h0,...
'units','points',...
'tag','t2',...
'style','text',...
'string','迭代步数:',...
'fontsize',10,...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[240 100 50 20]);
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','Jacobi 迭代法',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[250 60 60 20],...
'callback',huidiao);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'string','关闭',...
'style','pushbutton',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[250 30 60 20],...
'callback','close');

我自己找了这份代码,不知道正确否还望高手指点,谢谢
zhaolei1987 当前离线   回复时引用此帖
旧 2009-12-28, 12:22   #4
zhaolei1987
初级会员
 
注册日期: 2009-12-26
年龄: 37
帖子: 5
声望力: 0
zhaolei1987 正向着好的方向发展
默认 回复: 求一道编程

你看看吧,我也不知道是不是正确的
zhaolei1987 当前离线   回复时引用此帖
旧 2010-01-04, 10:37   #5
laosam280
高级会员
 
注册日期: 2008-11-07
住址: 湖南长沙
帖子: 233
声望力: 21
laosam280 正向着好的方向发展
默认 回复: 求一道编程

A=[10 -1 -2;-1 10 -2;-1 -1 5;];
b=[72,83,42]';
[x,n]=jacobi(A,b,[0 0 0]')

x =

11.0000
12.0000
13.0000


n =

17
% 迭代17次,求出精确解。
__________________
坚持就是胜利,努力就有奇迹。
laosam280 当前离线   回复时引用此帖
旧 2010-01-06, 17:07   #6
zhaolei1987
初级会员
 
注册日期: 2009-12-26
年龄: 37
帖子: 5
声望力: 0
zhaolei1987 正向着好的方向发展
默认 回复: 求一道编程

谢谢,麻烦高手具体指点下jacobi的过程,老师要求。。。
zhaolei1987 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 23:43


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.