Azzera filtri
Azzera filtri

how to add two matrix

1 visualizzazione (ultimi 30 giorni)
janny
janny il 18 Ott 2014
Commentato: Intisar Mohammed il 31 Mag 2020
hi guys i
  1 Commento
Intisar Mohammed
Intisar Mohammed il 31 Mag 2020
Addition of two square matrices 𝐴 𝑎𝑛𝑑 𝐵 of same order.

Accedi per commentare.

Risposta accettata

Roger Stafford
Roger Stafford il 18 Ott 2014
Let 'a' and 'b' be two row vectors. To add zeros to the left side of the shorter one so as to have equal lengths do this:
na = length(a);
nb = length(b);
n = max(na,nb);
a2 = [zeros(1,n-na),a];
b2 = [zeros(1,n-nb),b];
  4 Commenti
janny
janny il 18 Ott 2014
it works very fine.. thanks a lot
Image Analyst
Image Analyst il 18 Ott 2014
Can you go ahead and officially "Accept" his answer and also "vote" for it to give him credit/reputation points for it? Thanks in advance.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by