Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

nd asked in Science & MathematicsEngineering · 8 years ago

(matlab); arrays are given as x=[ 4 12 -5 2 10], y=[ 8 -6 -19 3 -7] use matlab to compute z= (5+x)/(y^2-xy)?

Question 1) arrays are given as x=[ 4 12 -5 2 10], y=[ 8 -6 -19 3 -7] use matlab to compute z= (5+x)/(y^2-xy)

a) show the long way to calculate z (you will have 5 lines)

b)use a for loop to calculate z

c) use vectorization to calculate z

question 2) set up a column vector x, which contains the values 1 thru 5, inclusive. use this variable, and matlab array operators to create new variables containing the values below

a) 2 4 6 8 10

b)1 1/2 1/3 1/4 1/5 (note, matlab will display 0.5000, not 1/2)

c) 1 4 9 16 25 36 49 64 81 100

d) 1/2 1 3/2 2 5/2

2 Answers

Relevance
  • Anonymous
    8 years ago
    Favorite Answer

    1a)

    x = [4 12 -5 2 10]

    y = [8 -6 -19 3 -7]

    z(1) = (5+x(1)) ./ (y(1).^2 - x(1) .* y(1))

    z(2) = (5+x(2)) ./ (y(2).^2 - x(2) .* y(2))

    etc.

    1b)

    See this example:

    matrixlab-examples.com/iteration.html

    1c)

    z = (5 + x) ./ (y.^2 - x.*y)

    2)

    See these examples:

    matrixlab-examples.com/vectors.html

  • Anonymous
    4 years ago

    you are able to extract submatrices promptly. no opt for to apply loops. B = A(a million:3,2:5) or % outline rows and columns [r c] [r c] [r c] [r c]= length(A) B = A(a million : r, 2 : c-a million) the area less than provides extra examples

Still have questions? Get your answers by asking now.