Question

command or explanation. 3. Given the matrix A [3 7 4ti 5; 0 -i -1 4; 3 8 4 -1] where i represents the imaginary number, run each of the commands below and explain the observed result. a. A c. A(10) f. A (I1 3], 13 2]) g. [A: A (end-1,:)1 h. A(, 12 4 1 3]) k. 1. m. n. o. p. sum (A) sum (A, 2) [A; sum (A) ] numel (A) B = reshape (A, 1, nume 1 (A) ) [r, c] size (A) [x,y] size (B) r. length (B)

Need help.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A = [ 3 7 4+i 5; 0 -i -1 4; 3 8 4 -1]
A =
   3.0000 + 0.0000i   7.0000 + 0.0000i   4.0000 + 1.0000i   5.0000 + 0.0000i
   0.0000 + 0.0000i   0.0000 - 1.0000i -1.0000 + 0.0000i   4.0000 + 0.0000i
   3.0000 + 0.0000i   8.0000 + 0.0000i   4.0000 + 0.0000i -1.0000 + 0.0000i
>> A'
ans =
   3.0000 + 0.0000i   0.0000 + 0.0000i   3.0000 + 0.0000i
   7.0000 + 0.0000i   0.0000 + 1.0000i   8.0000 + 0.0000i
   4.0000 - 1.0000i -1.0000 + 0.0000i   4.0000 + 0.0000i
   5.0000 + 0.0000i   4.0000 + 0.0000i -1.0000 + 0.0000i
>> %1. The complex conjugate transpose of a matrix interchanges the row and column index for each element. The operation also negates the imaginary part of any complex numbers.
>>
>>
>> A.'
ans =
   3.0000 + 0.0000i   0.0000 + 0.0000i   3.0000 + 0.0000i
   7.0000 + 0.0000i   0.0000 - 1.0000i   8.0000 + 0.0000i
   4.0000 + 1.0000i -1.0000 + 0.0000i   4.0000 + 0.0000i
   5.0000 + 0.0000i   4.0000 + 0.0000i -1.0000 + 0.0000i
>> %2. The trasnspose(') of a matrix returns the nonconjugate transpose of that matrix, interchanging the row and column index for each element, without affecting the sign of the imaginary parts.
>>
>>
>> A(10)
ans =
     5
>> %3. The data is stored in memorey columnwise, ie in order (3,0,3,7,-i,8....). Hence A(10) acceses 10th element in the list which is 5.
>>
>>
>> A(3,1)
ans =
     3
>> %3. Access third row, first column element whiich is 3.
>>
>>
>> A(:,[1:3]
A(:,[1:3]
          ?
Error: Expression or statement is incorrect--possibly unbalanced (, {, or
[.

Did you mean:
>> A(:,[1:3])
ans =
   3.0000 + 0.0000i   7.0000 + 0.0000i   4.0000 + 1.0000i
   0.0000 + 0.0000i   0.0000 - 1.0000i -1.0000 + 0.0000i
   3.0000 + 0.0000i   8.0000 + 0.0000i   4.0000 + 0.0000i
>> %4. : represents selection of all possible values in the matrix. Here row assumes all values possible and column from 1 to 3 are displayed. That is 4th column is omitted.
>>
>>
>> A([1 3],[3 2])
ans =
   4.0000 + 1.0000i   7.0000 + 0.0000i
   4.0000 + 0.0000i   8.0000 + 0.0000i
>> %5. It assumes the format of [A(1,3) A(1,2) ; A(3,3) A(3,2)]
>>
>>
>> [A; A(end-1,:)]
ans =
Columns 1 through 3
   3.0000 + 0.0000i   7.0000 + 0.0000i   4.0000 + 1.0000i
   0.0000 + 0.0000i   0.0000 - 1.0000i -1.0000 + 0.0000i
   3.0000 + 0.0000i   8.0000 + 0.0000i   4.0000 + 0.0000i
   0.0000 + 0.0000i   0.0000 - 1.0000i -1.0000 + 0.0000i
Column 4
   5.0000 + 0.0000i
   4.0000 + 0.0000i
-1.0000 + 0.0000i
   4.0000 + 0.0000i
>> %6. It prints A matrix completely. end of A = 3. Hence A(end-1;:) prints the second row as a new row
>>
>>
>> A(:,[2 4 1 3])
ans =
   7.0000 + 0.0000i   5.0000 + 0.0000i   3.0000 + 0.0000i   4.0000 + 1.0000i
   0.0000 - 1.0000i   4.0000 + 0.0000i   0.0000 + 0.0000i -1.0000 + 0.0000i
   8.0000 + 0.0000i -1.0000 + 0.0000i   3.0000 + 0.0000i   4.0000 + 0.0000i
>> %7. : selects all possible 4 rows. [2 4 1 3] selects and inserts 2nd,4th,1st,3rd columns repectively.
>>
>>
>> A(1:2,:)=[]
A =
     3     8     4    -1
>> %8. [] deletes the entry of a mtrix. Here two rows are deleted.
>>
>>
>> A(3:4,:) = [2:3:11;5:8]
A =
     3     8     4    -1
     0     0     0     0
     2     5     8    11
     5     6     7     8
>> %9. Adds rows 3 and 4.(Row to initialised to 0 automatically). Values using step function.
>>
>>
>> sum(A)
ans =
    10    19    19    18
>> %10. Prints cloumnwise sum.
>>
>>
>> sum(A,2)
ans =
    14
     0
    26
    26
>> %11. Prints rowwise sum of matrix. sum(A,2) operates on successive elements in the rows of A and returns a column vector of the sums of each row.
>>
>>
>> [A; sum(A)]
ans =
     3     8     4    -1
     0     0     0     0
     2     5     8    11
     5     6     7     8
    10    19    19    18
>> %12. Prints A matrix completely. Adds sum(A) as a 5th row
>>
>>
>> numel(A)
ans =
    16
>> %13. Returns number of elements in A
>>
>>
>> B = reshape(A,1,numel(A))
B =
Columns 1 through 13
     3     0     2     5     8     0     5     6     4     0     8     7    -1
Columns 14 through 16
     0    11     8
>> %14. Reshapes A matrix with 1 row and 19( numel(A) ) columns. Columnwise order is followed as always.
>>
>>
>> [r,c] =size(A)
r =
     4
c =
     4
>> %15. Returns size of matrix in rows and columns. A is 4x4 matrix.
>>
>>
>> [x,y] =size(B)
x =
     1
y =
    16
>> %16. Returns size of matrix in rows and columns. B is 1x16 matrix.
>>
>>
>> length(B)
ans =
    16
>> %17. length(A) returns the length of the largest array dimension in A. For vectors, the length is simply the number of elements
>>

MAILAB R2017a -academic use ength vineeth New Vcriable Preference Find Fle: Run and Tre Reques: Suppot Compare Impert Sac NzwMAILAB R2017a -academic use 0 ength Vineeth ▼ New Vcriable Open Vanabe Preference Find Fle: Run and Tre Reques: Suppot ComparMAILAB R2017a -academic use 0 ength Vineeth ▼ New Vcriable Open Vanabe Preference Find Fle: Run and Tre Reques: Suppot ComparMAILAB R2017a -academic use 0 ength vineeth Preference Eet Path New Vcriable Find Fle: VarabeAun and TeLyour lilI Paralel ReqMAILAB R2017a -academic use 0 ength Vineeth ▼ Preference Eet Path New Vcriable Find Fle: Run nd T Reques: Suppot Compare ImpaMAILAB R2017a -academic use 0 ength Vineeth ▼ New Vcriable Preference Find Fle: VarabeAun and TeLyour lilI Paralel Reques: SuMAILAB R2017a -academic use 0 ength Vineeth ▼ New Vcriable Preference Find Fle: VarabeAun and TeLyour lilI Paralel Reques: Su

Add a comment
Know the answer?
Add Answer to:
Need help. command or explanation. 3. Given the matrix A [3 7 4ti 5; 0 -i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5. A 3 × 3 matrix is given by A=1020 -i 0 1 (a) Verify that...

    5. A 3 × 3 matrix is given by A=1020 -i 0 1 (a) Verify that A is hermitian. (b) Calculate Tr (A) and det (A), where det (A) represents the determinant of A (c) Find the eigenvalues of A. Check that their product and sum are consistent with Prob. (5b) (d) Write down the diagonalized version of A (e) Find the three orthonormal eigenvectors of A. (f) Construct the unitary matrix U that diagonalizes A, and show explicitly that...

  • I need help with the creation of the pre and post conditions for each function of...

    I need help with the creation of the pre and post conditions for each function of my program. Please see below. #include <iostream> #include <string.h> using namespace std; #define TOTAL_COMMANDS 7 struct command { char name[1024]; // Store the name of the command int *paramsCount; // Stores the valid no. of params char error[4096]; // Stores the valid errors int differentParams; // Store no. of different ways to specify params int differentErrors; // Store no. of different ways to error...

  • 1. Provide a VERY short review for the ipconfig/ifconfig command. 2. Run the following command: i...

    1. Provide a VERY short review for the ipconfig/ifconfig command. 2. Run the following command: ipconfig /all (Windows) ifconfig /all (Linux/MAC) Report the IP addresses of your DNS servers. These IPs could be IPv6 and/or IPv4, identify them accordingly. Provide a snapshot of the results. 3. Provide a VERY short review for the tracert/traceroute command. 4. Run the following command: tracert www.louvre.fr (Windows) traceroute www.louvre.fr (Linux/MAC) Report the number of hops and time needed to reach the remote location. Provide...

  • 1. Suppose you have created a vector x in R using the command x <-c(2, 7,...

    1. Suppose you have created a vector x in R using the command x <-c(2, 7, 3, 1, 9) . Please find the results for the following commands (2) xlc(1,3,5)] (3) x [2:4] (5) length(x) (6) x [2: length(x)1 (7) x[1: length(x)-1] (8) max(x) (9) min(x) 2. Besides the vector x in question 1, suppose you have created another vector y in R using the command y <- c(1, 2, 3, 4, 5). Please find the results for the following...

  • Please help me with this. PLease make all the steps clear. ......... 24 Assume a matrix...

    Please help me with this. PLease make all the steps clear. ......... 24 Assume a matrix variable mat, as in the following example: ma t = 2 1 2 The following for lo 4 402 op r, size (mat) for i = 1:r sumprint (mat (i, : ) ) end prints this result: The sum is now 15 The sum is now 25 The sum is now 37 Write the function sumprint.

  • Exercise 1: Use Matlab command to obtain the following a) Extract the fourth row of the...

    Exercise 1: Use Matlab command to obtain the following a) Extract the fourth row of the matrix generated by magic(6) b) Show the results of 'x' multiply by 'y' and 'y' divides by 'x'. Given x = [0:0.1:1.1] and y=[10:21] c) Generate random matrix 'r' of size 4 by 5 with number varying between -8 and 9 Exercise 2: Use MATLAB commands to get exactly as the figure shown below x=pi/2:pi/10:2*pi; y=sin(x); z=cos (x);

  • explanation too Problems 7-11: The augmented matrix is given for a system of equations. If the...

    explanation too Problems 7-11: The augmented matrix is given for a system of equations. If the system is consistent, find the general solution. Otherwise state that there is no solution. State the solution in vector parametric form. In your augmented matrix, draw a vertical line that represents the equal sign, label all columns of the augmented matrix, and before each new row, write the operations that give you that new row and show the scratch work on the same page...

  • What are the exact commands I should use to complete the task? 1. Run command (date;...

    What are the exact commands I should use to complete the task? 1. Run command (date; sleep 45; echo “Done.”; date) > date.out in the foreground (i.e. without &) 2. Suspend it with Ctrl-Z. Pay attention to the number in the [], it will become handy later. This number is the job number of the command that has been suspended. 3. Run command top to display only processes started by you (i.e. associated with your userid). Write down the process...

  • I need help writing a program in python that reads from a file and performs matrix...

    I need help writing a program in python that reads from a file and performs matrix multiplication. the file has this format 1 4 2 1 1 1 1 1 1 2 2 3 3 4 4 which means : 1 #rows in A 4 #cols in A, rows in B 2 #cols in B Matrix A contents: 1 1 1 1 Matrix B contents: 1 1 2 2 3 3 4 4 i need to be able to read...

  • 1.Which of the following Linux scripting commands would be used to access the single command-line parameter...

    1.Which of the following Linux scripting commands would be used to access the single command-line parameter that a user has typed on the command-line? Group of answer choices A) $0 B) $# C) $$ D) $* E) $1 2. If I type the command “update my local Internet settings” (without the quotes) at the Linux command-line, from within the running script which of the following variables would the word “Internet” be stored in, if the script gets run correctly? Group...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT