声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1318|回复: 1

[综合讨论] 帮我看看 AX=B?

[复制链接]
发表于 2006-9-1 17:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
A是10X100维  X是100X1维   B是10X1维, 然后计算 X

for i=1:10,  u1(i)= sum(A(i,:)); end
u1=u1';

for j=1:100,  u2(j)= sum(A(:,j)); end
u2=u2';

    for i=1:10, A1(i,:)= A(i,:)*B(i)/u1(i); end
    for j=1:100, u3(j)= sum(A1(:,j)); end
u3=u3';

for j=1:100, x(j)= u3(j)/(u2(j)+eps); end

或者有更好的方法吗~~ 帮偶看看  :@(

[ 本帖最后由 ChaChing 于 2010-4-10 20:33 编辑 ]
回复
分享到:

使用道具 举报

发表于 2010-7-9 11:01 | 显示全部楼层
直接A\B即可! :@)
from matlab help :
If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B.

还有LZ的写法, 值得精进, 数值算法忘了精光, 仅就编程说说
u1=sum(A')'; %for i=1:10, u1(i)=sum(A(i,:)); end; u1=u1';
u2=sum(A)'; %for j=1:100, u2(j)=sum(A(:,j)); end; u2=u2';
u3=((B./u1)'*A)'; %for i=1:10, A1(i,:)= A(i,:)*B(i)/u1(i); end
%for j=1:100, u3(j)= sum(A1(:,j)); end; u3=u3';
x=u3./u2; %for j=1:100, x(j)= u3(j)/(u2(j)+eps); end
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-16 14:23 , Processed in 0.075641 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表