倒Pendelum矩阵导数近似

时间:2016-01-05 14:37:44

标签: matlab math differential-equations

我在这里写了一个动态函数:

     public function selectItemTable()
    {

        $buyId = Input::get('buyId'); 
        $buyTemps = DB::table('vbuytemp')->where('buyId',$buyId)->paginate(10);      
         return Response::json(compact('buyTemps'));    

}

此处有一个矩阵 Object {total: 1, per_page: 10, current_page: 1, last_page: 1, next_page_url: null…}current_page: 1data: Array[1]0: Objectbarcode: "08815408"buyBox: 30buyId: 2buyItemTempId: 2buyPrice: "2.500"buyQty: 90itemExpire: "2018-01-04"itemId: 2itemName: "Panadol Extra tab"itemPacking: 2minQty: 1roofId: 1sellingForm: 1__proto__: Objectlength: 1__proto__: Array[0]from: 1last_page: 1next_page_url: nullper_page: 10prev_page_url: nullto: 1total: 1__proto__: Object__defineGetter__: __defineGetter__()__defineSetter__: __defineSetter__()__lookupGetter__: __lookupGetter__()__lookupSetter__: __lookupSetter__()constructor: Object()hasOwnProperty: hasOwnProperty()isPrototypeOf: isPrototypeOf()propertyIsEnumerable: propertyIsEnumerable()toLocaleString: toLocaleString()toString: toString()valueOf: valueOf()get __proto__: get __proto__()set __proto__: set __proto__() ,函数输出与系统状态相关的function dAx = dynamic(t,x) global u; g = 9.8; l = 0.5; m = 0.5; h = 2; dx(1,1) = x(2); dx(2,1) = g/l*sin(x(1))-h/(m*l^2)*x(2)+1/(m*l)*cos(x(1))*u(1,1); dx(3,1) = g*lcos(x(3))-u(2,1); A = [x(1)*x(2)+10*x(1);10*x(2)-5*x(1);x(3)] dx = 1e-3 dAx = [(((x(1)+dx)+(x(1)-dx))*((x(2)+dx)+(x(2)-dx)))/(2*dx)+(10*(x(1)+dx)+(x(1)-dx))/(2*dx); ((10*(x(2)+dx)+(x(2)-dx))-5*((x(1)+dx)+(x(1)-dx)))/(2*dx); ((x(3)+dx)+(x(3)-dx))/(2*dx)]; % dA/dx using central derivative method computation

我尝试使用中心差异法。我的衍生矩阵计算是否正确?

1 个答案:

答案 0 :(得分:0)

@Lahidj dAx/dx是一个大小为nA的{​​{1}}矩阵。您可以按列计算此列。采取第一个状态(例如nx)。递增和递减一个小值x(1),如1e-3。获取增加和减少alpha值的A向量。计算这两个向量之间的差异,并将其除以(dx)的两倍。 dx。对其余的州/列重复此操作,您将获得(A_plus - A_minus)/(2*dx)