Open MATLab ---> In Home tab ----> Click on New -----> Select function
paste the following code and save it by it's default name.
function [A_Transp,errFlag] =
myMatrixChecker(A)
%Summary of this function goes here
% Detailed explanation goes here
B=size(A);%to find size
if B(1)==B(2)% to find whether it is square matrix or not
A_Transp = A'% for transpose
errFlag = 0
else
A_Trans=zeros(B)%to produce zeros matrix of input matrix size
errFlag = -1
disp('Given Matrix is not a
Square Matrix')
end
end
---> In Home tab ----> Click on New -----> Select Script
paste the following code, save it and run it by keeping both function file and script file in same folder.
clear all
A = input('Enter input Matrix of any size:');%Asks for user
input
myMatrixChecker(A);% calls function
Problem1: (5 Points) Write a function with the header: function [A_Transp, errFlag] myMatrixChecker (A) that transposes...
Write a function with the header [U, b2, L] = myForwardSweep(A,b) which performs systematic linear transformation on the augmented matrix [A|b]. Note that this function should return not only the transformed A and b, but also a matrix containing -m(i, j) used in the transformation but also with 1’s on its diagonal. Recall that m(i, j) = -A(i, j) / A(j, j) Since m will only populate with elements below the diagonal, you should first initialize m with nxn zeros.
Write a function with header [d] = myIEEE2Dec(IEEE)
Write a function with header [d]=myIEEE2Dec (IEEE), where IEEE is a 1 * 32 array of ones and zeros representing a 32-bit IEEE754 number. The output should be d, the equivalent decimal representation of IEEE. The input variable IEEE will always be a 32-element array of ones and zeros defining a 32-bit single precision float.
Please use C !!!
Write a C function matrixTranspose that takes a two-dimensional
array as its input argument then transposes its elements and prints
the results.
Develop the matrixTranspose method with two different
methods:
1. Assume the matrix is a square matrix. This will make finding the
transpose a simple swapping of the arrays’ elements and it can be
done in place.
2. Generalize your function to work with any NxM matrix where N≠M.
You will need to properly handle...
Write a function with the header: function [out] = myDataTypeChecker(A,B) takes two matrices A and B and has the following behavior (in this order): 1) if either A or B contains a “Not a Number”, the function should return -1. 2) if either A or B contains an +/-Infinity, the function should return -2 3) if either A or B is a character array, the function should return -3 4) if both A and B are logical arrays, the function...
Write a function Transpose that transposes a matrix T with M rows and N colums. The transposed matrix, TT, should have N rows and M columns. Example. Given the matrix T. (C++14) Example: 1 2 3 0 -6 7 The transposed matrix TT is 1 0 2 -6 3 7 DEFAULT CODE: Add to code as needed: #include <iostream> #include <string> #include <cmath> using namespace std; void Transpose(int T[100][100], int TT[100][100], int M, int N) { int i; int j;...
Objectives Work with functions Assignment Write each of the following functions using Python. The function header MUST be written as specified. In your main code test all of the specified functions. Each function must have a comment block explaining what it does, what the parameters are and what the return value is. Please remember the following two guidelines: unless the purpose of the function is to generate output DO NOT write to the screen within the function unless the purpose...
20. [5 points] Rewrite the following ML. function using patterns fun factn. ifn-0 then 1 else n fact (n-1) 21. [S points) Using map function, write an ML function int2real of type int list real list that takes a list of integers and returns the same numbers converted to real. For example, if the input is [1,2,3], the output should be like [1.0,2.0,3.0 22. [5 points] Using foldr function, write a function duplist of type·a list 'a list that takes...
Write the code in python
5. (10 points) Write a function that takes a square matrix and compute the summation of items on both diagonals. Example: 9 13 5 27 1 11X76 6 0 7 102
Problem1: BMPmain.c, BMPfns.c, BMPfns.h, Makefile The file 'BMPmain.c' contains a main() function which is already written for you and attached with this homework. When appropriate functions are provided, main() will create a .bmp image file. Your job is to write 'BMPfns.c' which contains the functions which main() uses to create .bmp image files. You must also write the header file 'BMPfns.h' to #include in BMPmain.c and which contains prototypes of the functions defined in BMPfns.c . Problem2: BMPcheckerboard.c, BMPfns.c, BMPfns.h,...
Write a function that takes, as an argument, a list of positive integers and a target value, and returns the number of times that the target value appears in the list. Call this function problem1(myList, target). For example, >>>problem1([1,2,3,4,5,6,5,4,3], 5) should return 2, and >>>problem1([1,2,3,4,5,6,5,4,3], 7) should return 0.