- + is a MATLAB operator (shorthand for the PLUS function),
- .+ does not exist.
What is the difference between + and .+ explain with example. Suppose i am adding two matrices which is best and what are their roles.
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
a = [2,3;5,6]
b = [2,5;6,9]
c = a + b
d = a .+ b
1 Commento
Stephen23
il 29 Ago 2024
Modificato: Stephen23
il 29 Ago 2024
"What is the difference between + and .+ explain with example."
The difference is very simple:
"Suppose i am adding two matrices which is best and what are their roles."
Using the operator that actually exists is more likely to succeed.
Risposte (1)
Star Strider
il 29 Ago 2024
Theree is no ‘.+’ (or ‘.-’) operator. (Using them would throw an error.) The dot operator with multiplication (‘.*’), division (‘./’), and exponentiation (‘.^’) are element-wise (array) operators, as opposed to matrix operators. Seee the documentation section on Array vs. Matrix Operations for details. Addition and subtraction are always element-wise operations.
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!