m0_59701385
2021-07-20 10:54
采纳率: 80%
浏览 39

Matlab 向量相乘问题

矩阵D_z = [722483478143.668,59820245325.4305,-4908044696.28673,8066748023.31476,588289266.823277,-586279368239.143;52871956232.2195,6443869298.76580,-361209979.771828,588289266.823276,85273557.8932953,-43113851863.2673;52510058821062.8,4365173390310.01,-356718832131.733,586279368239.143,43113851863.2674,-42611619281260.0;64708490769470.8,5366654578526.81,-439586953542.062,722483478143.667,52871956232.2196,-52510058821062.8;5366654578526.80,545841409946.368,-36556661167.5860,59820245325.4304,6443869298.76581,-4365173390310.01;439586953542.062,36556661167.5861,-2986197833.74336,4908044696.28673,361209979.771828,-356718832131.733]
R_0 =[4.98336244340045e-05;5.22560769642106e-06;-0.00771970922989240;0;0;0.000126569771011181]
R_z = D_z*R_0
计算结果为R_z =[7.89963929138611e-09;-5.21738246578461e-11;1.83363302230939e-07;-6.57502726960382e-08;4.25865463971400e-08;-1.05253038136285e-08]
可是当我用 D_z(1,:)*R_0 时 ans=1.490116119384766e-08 不等于R_z(1)啊 什么情况

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • CSDN专家-Matlab_Fans 2021-07-20 22:13
    已采纳

    数值误差的影响,矩阵相称数值量级相差太大,造成了误差,若要解决此问题,计算时使用符号量代替数值量,如下:

    format long
    D_z = [722483478143.668,59820245325.4305,-4908044696.28673,8066748023.31476,588289266.823277,-586279368239.143;52871956232.2195,6443869298.76580,-361209979.771828,588289266.823276,85273557.8932953,-43113851863.2673;52510058821062.8,4365173390310.01,-356718832131.733,586279368239.143,43113851863.2674,-42611619281260.0;64708490769470.8,5366654578526.81,-439586953542.062,722483478143.667,52871956232.2196,-52510058821062.8;5366654578526.80,545841409946.368,-36556661167.5860,59820245325.4304,6443869298.76581,-4365173390310.01;439586953542.062,36556661167.5861,-2986197833.74336,4908044696.28673,361209979.771828,-356718832131.733]
    R_0 =[4.98336244340045e-05;5.22560769642106e-06;-0.00771970922989240;0;0;0.000126569771011181]
    R_z = sym(D_z)*sym(R_0);
    
    R1 = R_z(1)
    R2 = sym(D_z(1,:))*sym(R_0) 
    
    R1s = double(R1)
    R2s = double(R2)
    

    结果:

    
    R1 =
     
    10952043364488277297/77371252455336267181195264
     
     
    R2 =
     
    10952043364488277297/77371252455336267181195264
     
    
    R1s =
    
         1.415518427960115e-07
    
    
    R2s =
    
         1.415518427960115e-07
    
    评论
    解决 1 无用
    打赏 举报

相关推荐 更多相似问题