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

Part 2: Solve the following problems in MATLAB 1. Fill in the function N myNull

ID: 2086212 • Letter: P

Question

Part 2: Solve the following problems in MATLAB 1. Fill in the function N myNull (A) to create a matrix N whose columns are the homogeneous solutions (i.e. elements of the null space of A). The output of your function should match that of Matlab's built-in function, Nnull (A, "r'). Note that this uses the optional second input 'r' 2. Fill in the function xmyLeastSquares (A, b) to find the least squares solution to Ax- b. Remember that if a solution does exist, this will also be the least squares solution. The output of your function should match that of Matlab's built-in command xAlb

Explanation / Answer

MATLAB CODE-

Part (A)

1.

function N = myNull(A)

N=rotm2tform(A);

2.

clc

clear

close all;

A=[1 0 0;0 -1 0;0 0 -1];

N=myNull(A);

disp(N)

Part (B)

1.

function x = myleastsquare(A,b)

x = A;

2.

clc

clear

close all;

A=magic(3);

B=[15; 15; 15];

x=myleastsquare(A,B);

disp(x)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote