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

Please write the following necessary codes in MATLAB programming. Consider some

ID: 3781865 • Letter: P

Question

Please write the following necessary codes in MATLAB programming.

Consider some oversights involving assignment statements. What is the difference between the following two assignment statements? Write a code that contains them and illustrate with specific examples to show that sometimes x = y and sometimes x notequalto y. integer m, n; real x, y x leftarrow real(m/n) y leftarrow real(m)/real(n) output x, y What value does n receive? integer n; real x, y x leftarrow 7.4 y leftarrow 3.8 n leftarrow x + y output n What happens when the last statement is replaced with the following? n leftarrow integer(x) + integer(y)

Explanation / Answer

% matlab code part A

% since in matlab by deafult a variable is considered as float and not an inetger
% hence, both values of x and y will be same
x = real(m/n);
y = real(m)/real(n);
disp(x);
disp(y);


% matlab code part B
x = 7.4;
y = 3.8;
n = x+y;
disp(n);
% output: 11.200
% x and y are converted to inetger and added
n = int64(x) + int64(y);
disp(n);
% output: 11