Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Guys, help! Who can solve this complicated MATLAB problem? & Please provide a cl

ID: 2291393 • Letter: G

Question

Guys, help!
Who can solve this complicated MATLAB problem? & Please provide a clear answer because I need to understand it.
Problem statement The goal of this project is to use matlab program to simulate a submarine's velocity and acceleration variations with different amount of water inside. The student should use the knowledge of Newton's second aw of motion, buoyancy force and associated matlab programming skl to complete the simulation. Step-by-step program development . Step : use a simplified model for the submarine (a hollow cube), let the user specify the dimensions (i.e. outer shel length L, thickness 1) and the material of the cube submarine (e.g, can be one of the 5 materials as listed on Table 5.2, page 188 of the textbook). One restriction is that the thickness should be smaller than 5% of the shell length (i.e. ,

Explanation / Answer

Solution:

The below data illuistrates according to ther given data;

% Initial conditions:

persistent x_est p_est

if isempty(x_est)

x_est = zeros(6, 1);

p_est = zeros(6, 6);

end

x_est is initialized to an empty 6x1 column vector and updated each time the filter is used.

The Kalman filter uses the laws of motion to estimate the new state:

X=X

0

+Vx.dt

Y=Y

0

+Vy.dt

Vx=Vx

0

+Ax.dt

Vy=Vy

0

+Ay.dt

These laws of motion are captured in the state transition matrix A, which is a matrix that contains the coefficient values of x, y, Vx, Vy, Ax, and Ay.

% Initialize state transition matrix:

dt=1;

A=[ 1 0 dt 0 0 0;...

0 1 0 dt 0 0;...

0 0 1 0 dt 0;...

0 0 0 1 0 dt;...

0 0 0 0 1 0 ;...

0 0 0 0 0 1 ];

Filtering Process

The filtering process has two phases:

->Predicted state and covariance

->The Kalman filter uses the previously estimated state, x_est, to predict the current state, x_prd. The predicted state and covariance are calculated in:

% Predicted state and covariance

x_prd = A * x_est;

p_prd = A p_est A' + Q;

Estimation

->The filter also uses the current measurement, z, and the predicted state, x_prd, to estimate a more accurate approximation of the current state.

The estimated state and covariance are calculated in:

% Measurement matrix

H = [ 1 0 0 0 0 0; 0 1 0 0 0 0 ];

Q = eye(6);

R = 1000 * eye(2);

% Estimation

S = H p_prd' H' + R;

B = H * p_prd';

klm_gain = (S B)';

% Estimated state and covariance

x_est = x_prd + klm_gain (z - H x_prd);

p_est = p_prd - klm_gain H p_prd;

% Compute the estimated measurements

y = H * x_est;