Part 2: Solve the following problems in MATLAB 1. Fill in the function N myNull
ID: 3741501 • 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 buit-in command x - Alb.Explanation / Answer
SAVE THE FOLLOWING CODE IN AMTLAB AND GET THE RESULTS-
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)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.