Question

a) Considering the relationship of vectors a = [4 4 4 4 4 4] and b = [-1 3 7 11 15 19], write a piece of code that uses a mat

Use MATLAB.

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

Here given vector a = [4,4,4,4,4,4] and b = [-1, 3, 7, 15, 19]
to get vector b from a we have to add the vector [-5, -1, 3, 7, 11, 15]
as for now we have to add this vector for each row in the magic matrix A for that we will create a 6X6 matrix with same row 6 times
so by adding this two matrices we can get matrix B
%creating magic matrix A
A = magic(6)
%creating a temporary matrix to perform operations
temp = [-5, -1, 3, 7, 11, 15;-5, -1, 3, 7, 11, 15;-5, -1, 3, 7, 11, 15;-5, -1, 3, 7, 11, 15;-5, -1, 3, 7, 11, 15;-5, -1, 3, 7, 11, 15]
%adding A and temporary matix to store the result in B
B = A + temp
%calculating the even number in the B and storing them in vector v
v = []
for row = 1:size(B, 1)
for col = 1:size(B, 2)
if(mod(B(row, col), 2) == 0)
v = [v, B(row, col)]
end
end
end

Activities Mon 22:43 9 Google Chrome computer Science questi x matlab online compiler- X I compile octave online X Add SINGLE

Activities Mon 22:43 9 Google Chrome C Computer Science questic x G matlab online compiler - X I compile octave online x Add

Mon 22:43 Activities 9 Google Chrome C Computer Science questic X G matlab online compiler- X I compile octave online X Add S

If you have any doubts please comment and please don't dislike.

Add a comment
Know the answer?
Add Answer to:
Use MATLAB. a) Considering the relationship of vectors a = [4 4 4 4 4 4]...
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
  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • 1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand....

    1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand. b. Explain why you chose this technique over others. Year 3 Year 1 Year 2 Actual Actual Actual Forecast Forecast Forecast Demand Demand Demand Week 1 52 57 63 55 66 77 Week 2 49 58 68 69 75 65 Week 3 47 50 58 65 80 74 Week 4 60 53 58 55 78 67 57 Week 5 49 57 64 76 77...

  • 3.3 Table 3.10 shows the scores in the final examination F and the scores in two preliminary exam...

    3.3 Table 3.10 shows the scores in the final examination F and the scores in two preliminary examinations P1 and P2 for 22 students in a statistics course. The data can be found in the book's Web site. (a) Fit each of the following models to the data: Model 1 F Bo BiP Model 2 F- Model 3 : F-k) + AP,+AP, + ε Table 3.10 Examination Data: Scores in the Final (F), First Preliminary (Pi), and Second Preliminary (P2)...

  • Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding...

    Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding each answer to the nearest whole number. Using the frequency distribution below (scores on a statistics exam taken by 80 students), determine:ion 1 of the preliminary test (scores on a statistics exam taken by 80 students), determine: 68 84 75 82 68 90 62 88 76 93 73 79 88 73 60 93 71 59 85 75 61 65 75 87 74 62 95...

  • Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding...

    Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding each answer to the nearest whole number. Using the frequency distribution below (scores on a statistics exam taken by 80 students), determine:ion 1 of the preliminary test (scores on a statistics exam taken by 80 students), determine: 68 84 75 82 68 90 62 88 76 93 73 79 88 73 60 93 71 59 85 75 61 65 75 87 74 62 95...

  • matlab( answer the question in matlab) show the full answer with comment please. W a rnction...

    matlab( answer the question in matlab) show the full answer with comment please. W a rnction to find the largest product of adjacent number pairs in a matrix, where pair combinations can be selected the horsonal accent or vertically adjacent (but not diagonally adjacent) of numbers in a matrix are accent if they are in the same row or column and located next to each other when the 2D matrix is displayed The largest product of a pair of adjacent...

  • How to solve this USING SAS EG? THANKS Automobile collisions: The number of collision claims (COL...

    How to solve this USING SAS EG? THANKS Automobile collisions: The number of collision claims (COLLISION) reported for 1984-1986 cars are listed for 9 car categories: small two-door, midsized two-door, large two-door, small four-door, midsized four-door, large four-door, small station wagons and vans, midsized station wagons and vans, large station wagons and vans.. a. In excel convert the data to the format which is appropriate for SAS EG (the data should have 2 columns with names CARCLAS and CRASH). b....

  • An article of the American Journal of Clinical Pathology, by Metz et al. (A-4) published the...

    An article of the American Journal of Clinical Pathology, by Metz et al. (A-4) published the comparison of three methods to determine the percentage of dysmorphic erythrocytes in the urine. They obtained the following results when using the A (X) and B (Y) methods in 75 urine samples. Draw a scatter diagram and obtain the regression equation and graph it on the diagram. X            Y            X            Y            X            Y            X            Y 0            0            20          16          65          55          89          81 0           ...

  • Write a python nested for loop that prints out the following pattern 100 99 98 97...

    Write a python nested for loop that prints out the following pattern 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33...

  • 'Student Pair' 'Standard Teaching Method' 'New Teaching Method' 1 51 67 2 72 90 3 85...

    'Student Pair' 'Standard Teaching Method' 'New Teaching Method' 1 51 67 2 72 90 3 85 82 4 51 63 5 73 76 6 72 73 7 65 78 8 72 94 9 72 85 10 95 100 11 70 80 12 60 72 13 57 100 14 48 58 15 74 89 16 63 97 17 82 88 18 57 45 19 87 81 20 65 99 21 48 69 22 97 70 23 61 47 24 83 73...

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
Active Questions
ADVERTISEMENT