You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: MPC.m
    path of file: ./repos/MPC-Implementation/Matlab Implementation
    
    the code of the file until where you have to start completion: function[Error, x0, sc, xs, a_p, b_p, FOV_X, FOV_Y] = MPC(w1, w2, x0, xs, sc)
addpath('C:\Users\Dev Soni\Desktop\casadi')
import casadi.*

%% Defining the system of UAV ------------------------------------------------------------------------------------------

T = 0.2;
N = 15;

% Constrains of UAV with gimbal

% input constrains of UAV
v_u_min = 14; v_u_max = 30;
omega_2_u_min = -pi/30; omega_2_u_max = pi/30;
omega_3_u_min = -pi/21; omega_3_u_max = pi/21;

% input constrains of gimbal
omega_1_g_min = -pi/30; omega_1_g_max = pi/30;
omega_2_g_min = -pi/30; omega_2_g_max = pi/30;
omega_3_g_min = -pi/30; omega_3_g_max = pi/30;
  
%
    
function
g = [];  %constrains of pitch angle theta

for k=1:N
    stt = X(1:8,1:N); A= SX.sym('A',N); B= SX.sym('B',N); C= SX.sym('C',N); X_E= SX.sym('X_E',N); Y_E= SX.sym('Y_E',N);
    
    VFOV = 1; % Making FOV 
    HFOV = 1;
    
    %w1 = 1;   %MPC weights
    %w2 = 2;
    
    a = (stt(3,k)*(tan(stt(7,k)+VFOV/2)) - stt(3,k)*tan(stt(7,k)-VFOV/2))/2;  %FOV Stuff
    b = (stt(3,k)*(tan(stt(6,k)+HFOV/2)) - stt(3,k)*tan(stt(6,k)-HFOV/2))/2;
    A(k) = ((cos(stt(8,k)))^2)/a^2 + ((sin(stt(8,k)))^2)/b^2;
    B(k) = 2*cos(stt(8,k))*sin(stt(8,k))*((1/a^2)-(1/b^2));
    C(k) = ((sin(stt(8,k)))^2)/a^2 + ((cos(stt(8,k)))^2)/b^2;
    
    X_E(k) = stt(1,k) + a + stt(3,k)*(tan(stt(7,k)-VFOV/2));                  %Centre of FOV  
    Y_E(k) = stt(2,k) + b + stt(3,k)*(tan(stt(6,k)-HFOV/2));
    
    obj = obj + w1*sqrt((stt(1,k)-P(9))^2 + (stt(2,k)-P(10))^2) + w2*((A(k)*(P(9)-X_E(k))^2 +...
        B(k)*(P(10)-Y_E(k))*(P(9)-X_E(k)) + C(k)*(P(10)-Y_E(k))^2)-1);
end