0

我正在尝试计算几百行数据,使用矩阵求解线性方程组。我正在根据行数据构建矩阵。我取结果 3x3 的倒数,然后乘以两次,一次用于 x,一次用于 y。我从中得到 6 个变量:a,b,c,d,ef. 如何复制示例以便解决所有行?我正在提供数据,然后是我现在使用的公式。现在,如果我向下复制它会跳过 3 行,或者如果我用 3 个示例向下复制它会跳过 9 行。我的意思是我想我可以尝试在所有 300 行中插入额外的行,所以我最终得到 900 行,但必须有一个更简单的方法!

我不知道如何让我的数据正确填充在这里,所以这里有一个链接:http ://codepad.org/qZwua3h9

注意:我拆分了矩阵行,以便您可以更轻松地查看它们,它们没有在我的工作表上拆分。

编辑:如果有人能弄清楚如何在这里粘贴示例数据,我会欢迎它,以便将来这篇文章可能对某人有用。我不确定键盘可以保存多长时间。

4

1 回答 1

0

I gave up and came to the conclusion that there is no reasonable amount of effort that will yield the desired results. Not only was the example case only ONE transformation, but the intended case was for 3 transformations - so three times the work. I came up with a Matlab solution in about 15 minutes. I understand that not everyone has access to Matlab though. So, if someone comes up with any reasonable working excel solution, I would welcome the knowledge and mark that answer as the accepted one. Regardless, here is the Matlab script:

  M = csvread('pointData.csv');

  T1result = zeros(215,6);
  T2result = zeros(215,6);
  T3result = zeros(215,6);

  for i=1:215,
      m = [M(i,1) M(i,2) 1; M(i,3) M(i,4) 1; M(i,5) M(i,6) 1];
      x = [M(i,7);M(i,9);M(i,11)];
      y = [M(i,8);M(i,10);M(i,12)];
      xresult = m\x;
      yresult = m\y;
      T1result(i,:) = [transpose(xresult),transpose(yresult)];

      m = [M(i,7) M(i,8) 1; M(i,9) M(i,10) 1; M(i,11) M(i,12) 1];
      x = [M(i,13);M(i,15);M(i,17)];
      y = [M(i,14);M(i,16);M(i,18)];
      xresult = m\x;
      yresult = m\y;
      T2result(i,:) = [transpose(xresult),transpose(yresult)];

      m = [M(i,13) M(i,14) 1; M(i,15) M(i,16) 1; M(i,17) M(i,18) 1];
      x = [M(i,19);M(i,21);M(i,23)];
      y = [M(i,20);M(i,22);M(i,24)];
      xresult = m\x;
      yresult = m\y;
      T3result(i,:) = [transpose(xresult),transpose(yresult)];
  end

  LeafId = csvread('extraColumnsForID.csv');
  Tresult = [LeafId, T1result, T2result, T3result];

  csvwrite('transforms.csv',Tresult);
于 2013-04-16T21:06:05.277 回答