How to Perform addition/subtract/multiplication/division for two different vectors of the same length?

Here are the two different vectors of the same length. a = [2, 1, 4]; b = [2 2 1];

Team Leader Asked on December 6, 2017 in MATLAB.
Add Comment
1 Answer(s)

>> a = [2  1  4]; b = [2   2   1]; c = a + b

c =
4  3  5

>> c = a – b
c =
0   -1  3

>> c = a .* b
c =
4  2 4

>> c = a ./ b
c =
1.0000     0.5000   4.0000

Team Leader Answered on December 6, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.