The Best Place to Get MATLAB Project Help In the UKSuccessful Completion of MATLAB projects has proven to be a daunting task for many students in the UK but as a student, you don’t have to worry anymore about complex MATLAB projects causing you trouble because we are here to ensure all your projects...

```
%% Question 2
% Input values
vxi = [0 -0.2478 -0.4943 -0.7384 -0.9786];
vyi = [4 3.9915 3.9659 3.9234 3.8644];
ti = [0 0.04 0.08 0.12 0.17];
% Initial values
x1 = 4;
y1 = 0;
% Calculate x2, x3, x4, y2, y3, y4
x2 = x1 + vxi(1)*(ti(2)-ti(1));
x3 = x1 + vxi(2)*(ti(3)-ti(2));
x4 = x1 + vxi(3)*(ti(4)-ti(3));
y2 = y1 + vyi(1)*(ti(2)-ti(1));
y3 = y1 + vyi(2)*(ti(3)-ti(2));
y4 = y1 + vyi(3)*(ti(4)-ti(3));
%% Question 3
% Read file into a table
data = readtable('A1_input.txt');
% Do not take into account the first element of the data because that one
% contains the units
for k = 2:size(data,1)
t(k-1) = str2double(data.time{k});
vx(k-1) = str2double(data.vx{k});
vy(k-1) = str2double(data.vy{k});
end
% Display the first four values
[t(1:4)', vx(1:4)', vy(1:4)']
%% Question 4
% Plot vx and vy in the same graph
figure
plot(t, vx, t, vy);
grid on
legend('vx', 'vy');
xlabel('Time (s)');
ylabel('Velocity (m/s)');
grid on
%% Question 5
% Calculate x and y positions using for loop
x(1) = x1;
y(1) = y1;
for k = 2:length(t)
x(k) = x1;
y(k) = y1;
for j = 1:k-1
x(k) = x(k) + vx(j)*(t(j+1)-t(j));
y(k) = y(k) + vy(j)*(t(j+1)-t(j));
end
end
%% Question 6
% Calculate x and y positions with vector operations
% x and y using vectors
% vectors of tj+1 tj
tvec = t(2:end) - t(1:end-1);
xv = cumsum(vx(1:end-1).*tvec);
xv = xv + x1;
xv = [x1, xv];
yv = cumsum(vy(1:end-1).*tvec);
yv = yv + y1;
yv = [y1, yv];
%% Question 7
% Plot the original datapoints and the calculated ones
figure
hold on
plot(t, x);
plot(t, y);
plot(t, xv, 'k--', 'linewidth', 3);
plot(t, yv, 'g--', 'linewidth', 3);
grid on
xlabel('Time (s)');
ylabel('Position');
legend('X-position from Q5', 'Y-position from Q5', 'X-position from Q6', 'Y-position from Q6');
%% Question 8
% Plot the trajectory
figure
plot(xv, yv), grid on
xlabel('X-Position (m)');
ylabel('Y-Position (m)');
%% Question 9
% Write a new file
file = fopen('output.txt', 'wt');
fprintf(file, 'Time\tx\ty\n');
fprintf(file, '(s)\t(m)\t(m)\n');
for k = 1:length(t)
fprintf(file, '%.3f\t%.3f\t%.3f\n', t(k),xv(k), yv(k));
end
fclose(file);
%% Question 10
% Write a new file
file = fopen('output2.txt', 'wt');
fprintf(file, 'Time\tx\ty\n');
fprintf(file, '(s)\t(m)\t(m)\n');
fprintf(file, '%.3f\t%.3f\t%.3f\n', t',xv', yv');
fclose(file);
```

```
P = 0; % initial money in the account
deposit_per_year = [288, 345, 355, 382, 392]; % amounts deposited each month, per year (year 1, year2, ... year5)
withdraw = 2331; % amount to be withdrawn each year
r = 0.04; % interes of the saving account
rcd = 0.08; % interest of the CD
n_CD = 0; % number of CDs bought
year = 1;
deposited = 0;
for i = 1:5*12 % 5 years, 12 months per year: total 60 months
% if i < 60
% deposited = deposit_per_year(year);
% else
% deposited = deposit_per_year(5);
% end
deposited = deposit_per_year(year);
P = P*(1+r);
P = P + deposited;
fprintf("Deposited %.2f at month %.0f. Current amount: %.4f\n", deposited, i, P);
if mod(i,12) == 0 % the end of a year
if P > 2811
fprintf('Amount in account: %.4f. Withdrawed %.2f at the end of year %0.f\n', P, withdraw, year);
P = P - withdraw;
n_CD = n_CD + 1;
% Formula of compound anually. We use the interest rate of the
% CD multiplied by the number of CDs
P = P*(1+(n_CD-1)*rcd);
end
year = year + 1;
end
end
fprintf("\nThe final amount in the account after %.0f years is: %.4f\n", 5, P)
```