matlab矩阵与数除法,Matlab中的矩阵除法有问题???

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

x=rand(5)

x =

0.5470    0.1835    0.9294    0.3063    0.6443

0.2963    0.3685    0.7757    0.5085    0.3786

0.7447    0.6256    0.4868    0.5108    0.8116

0.1890    0.7802    0.4359    0.8176    0.5328

0.6868    0.0811    0.4468    0.7948    0.3507

>> a=rand(5)

a =

0.9390    0.2077    0.1948    0.3111    0.9797

0.8759    0.3012    0.2259    0.9234    0.4389

0.5502    0.4709    0.1707    0.4302    0.1111

0.6225    0.2305    0.2277    0.1848    0.2581

0.5870    0.8443    0.4357    0.9049    0.4087

>> y=x*a

y =

1.7546    1.2212    0.6571    1.3791    1.0621

1.5666    0.9747    0.5541    1.2027    0.8242

2.3095    1.3754    0.8394    1.8476    1.5218

1.9224    1.1179    0.7058    1.6000    1.0048

1.6624    0.8568    0.5621    0.9450    1.1066

>> x1=y*inv(a)

x1 =

0.5470    0.1835    0.9294    0.3063    0.6443

0.2963    0.3685    0.7757    0.5085    0.3786

0.7447    0.6256    0.4868    0.5108    0.8116

0.1890    0.7802    0.4359    0.8176    0.5328

0.6868    0.0811    0.4468    0.7948    0.3507

>> norm(x1-x)

ans =

3.1081e-015误差很小了

x2=y/a (与x2=y*inv(a)等价)

x2 =

0.5470    0.1835    0.9294    0.3063    0.6443

0.2963    0.3685    0.7757    0.5085    0.3786

0.7447    0.6256    0.4868    0.5108    0.8116

0.1890    0.7802    0.4359    0.8176    0.5328

0.6868    0.0811    0.4468    0.7948    0.3507

>> norm(x2-x)

ans =

1.7692e-015误差很小了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值