user2868118
user2868118

Reputation: 43

To subtract a vector of values in matlab

Please is there a matlab code to subtract two vector values where one value is always the larger?

Eg;

A=[10 9 8 7 6 5 4 3 2 1]; B=[5 4 3 2 1 10 9 8 7 6]; 

I want to subtract these two vectors where the minuend is always the larger so that the answer will be:

[5 5 5 5 5 5 5 5 5 5]

How can I do this?

Upvotes: 1

Views: 102

Answers (1)

Franck Dernoncourt
Franck Dernoncourt

Reputation: 83177

Use the following code: abs(A-B)

Upvotes: 2

Related Questions