我怎样才能在for循环中声明矩阵

时间:2016-01-06 04:40:24

标签: c#

$(document).ready(function(){
  $("#addpc").submit(function(){
    var formdata=$("#addpc").serialize();
    $.ajax({
      url:"asset_management/addcomp",
      type:"POST",
      data: formdata,
      async: true,
    }).done(function( formdata ) {
      $('#info').html(formdata);
      $("#addpc")[0].reset();
      viewdata();
    });
    return false;
  });
});

对于上面的代码,如果我每次k改变时将qk(k)设置为新矩阵。无论如何要做到这一点?我尝试声明为for (k = 0; k < 5; k++) { Xnew[k + 1] = Xold[k] + (T * MPCV[k]) * Math.Cos(Aold[k]); Ynew[k + 1] = Yold[k] + (T * MPCV[k]) * Math.Sin(Aold[k]); Anew[k + 1] = Aold[k] + (T * MPCW[k]); Console.WriteLine("\nXnew = {0}", Xnew[k + 1]); Console.WriteLine("Ynew = {0}", Ynew[k + 1]); Console.WriteLine("Tnew = {0}", Anew[k + 1]); double[,] qk = { { Xnew[k + 1] }, { Ynew[k + 1] }, { Anew[k + 1] } }; Console.WriteLine("the element is {0}", Xnew[k + 1]); Console.WriteLine("the element is {0}", Ynew[k + 1]); Console.WriteLine("the element is {0}", Anew[k + 1]); } ,但它没有用。

一个例子是当我的k增加时,我的Xnew,ynew和anew的值也将随k变化。因此,我会声明q(k)当k增加时k将增加并且重新存储值xnew ynew。

0 个答案:

没有答案