Question

Exercise 1: Use Matlab command to obtain the following a) Extract the fourth row of the matrix generated by magic(6) b) Show
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) extracting the fourth row of a matrix magic(6) which is a 6*6 square matrix

>>A=magic(6)

>>B=A(4,:)   %This is used to extract the 4th row of the matrix

b)x multiply by y.(multiplying the corresponding element).

x is a 1*12 matrix and y is also a 1*12 matrix .Multiplying the corresponding element will give 1*12 matrix .

>> x.*y
ans =

Columns 1 through 4:

    0.00000    1.10000    2.40000    3.90000

Columns 5 through 8:

    5.60000    7.50000    9.60000   11.90000

Columns 9 through 12:

   14.40000   17.10000   20.00000   23.10000

y divides x .Dividing corresponding values.

>> y./x
ans =

Columns 1 through 8:

       Inf   110.000    60.000    43.333    35.000    30.000    26.667    24.286

Columns 9 through 12:

    22.500    21.111    20.000    19.091

c) Generating random matrix r of size 4 by 5 with number varying between -8 and 9

>>r=randi([-8,9],4,5)

output:

>>

r =

-1 -6 -1 -8 -2
   1   8 -3 -3   4
   0   3 -4   7   8
-6   5 -5   4 -2

Add a comment
Know the answer?
Add Answer to:
Exercise 1: Use Matlab command to obtain the following a) Extract the fourth row of the...
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
  • Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices...

    Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices and vectors in MATLAB [ 2 -6 3 ] [ 5 ] -3 A= 2 -7 -2 , B= 2 -2 -3 , b= -13 , c= 3 -1 4], d= 0 [ 7 -2 7 [1 -8 -1 ] [ 10 (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). - 3 (b) Construct a 6 x...

  • You have to use MATLAB to solve these questions. Please answer these 5 questions! ercise 1:...

    You have to use MATLAB to solve these questions. Please answer these 5 questions! ercise 1: pae). eate a graph of y cos4x over [0, n]. To illustrate what happens when there are too few points in your domain, first try a step size of n/ 10 1. Which command gives the desired values for x? Select exactiy one of the cholices 2. Which command gives the correct answer for Select exactly one of the choice y - cos(4x) y...

  • Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440;...

    Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440; %Frequency of note A is 440 Hz A=sin(2*pi*F_A*t); sound(A,Fs); Type toneA at the command line and then answer the following: (a) What is the time duration of A? (b) How many elements are there in A? (c) Modify toneA.m by changing “Fs=5000” to “Fs=10000”. Can you hear any difference? (d) Create a file named “tone.m” with the following MATLAB code: function x = tone(frequency,...

  • Matlab answer only Form 1 6) [10 pts] Consider the following two matrices B=[S A 3...

    Matlab answer only Form 1 6) [10 pts] Consider the following two matrices B=[S A 3 1 5 -7 4 6-3] a) Obtain the sum of each row of matrix A. b) Use the size function to create a magic matrix P which has the same size as matrix A. c) Create a matrix called Q from the second column of matrix A d) Extract the four numbers in the lower left-hand corner of matrix A and create matrix R....

  • cope the code please thanks Write a MATLAB code to obtain the following. Keep your code...

    cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...

  • Use MATLAB to generate code for this 4.Given the following functions: (1)  f1 (x, y) = cos...

    Use MATLAB to generate code for this 4.Given the following functions: (1)  f1 (x, y) = cos (3 x); (2) f2 (x, y) = cos (5 y); (3) f3 (x, y) = cos (3 x) cos (5 y); Please plot 3D plots/images for each of the functions. Please show your steps/ derivations to explain why you obtain those plots/figures.

  • need matlab code Exercise: Use MATLAB to generate a low frequency signal: xy(t) = 3 cos(1400)...

    need matlab code Exercise: Use MATLAB to generate a low frequency signal: xy(t) = 3 cos(1400) And a higher frequency signal: xz(t) = 2 cos(10,000st) Now add these two signals together to generate the dual-component signal: y(t) = 3 cos(14007a)+ 2 cos(10,000) Points to be addressed: Again, manually calculate the theoretical magnitude spectra of y(t) and show this in your report (use Microsoft Visio or similar for your diagram). Clearly label all axes! Contrast this working to what you see...

  • Use Matlab to create an array x of values from 0 to 2 pi in steps...

    Use Matlab to create an array x of values from 0 to 2 pi in steps of 0.1, y1 = sin(x), y2 cos(x). Plot y1 and y2 as a function of x on a single plot. Take a screen shot of your plot and include it in the word document.

  • RUN # VI Use Matlab to obtain plots of the following spectrums for: -5s ws5: 1....

    RUN # VI Use Matlab to obtain plots of the following spectrums for: -5s ws5: 1. Yi (w)-5 (w) 2. Y2(w)-5 o(w-3) 4. Y(w)- 10 5. Ys(w)-1-u(-w) 6. Y(w) sin(3w) 8. Ys(w)cos(3w) 9. Yo(w) jw +I RUN # VII obtain the inverse Fourier transform of the functions defined in RUN # VI, by hand if possible or by using the standard transformation tables and/or the properties of the transform ( clearly indicate the properties employed in the evaluation process)

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