Previous matrix numbers in the formula and creating a new matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am given a matrix A=[1 2 3;4 5 6;7 8 9] ,I want to place numbers in this formula
g(x,y)=((A(x,y)-1)/(11))*(15);
Then get a new matrix B=[g(x,y)]
How to do it.
Thanks for the help
0 commentaires
Réponse acceptée
Steven Lord
le 24 Juil 2022
The arithmetic operators plus, +, minus, -, times, .*, ldivide, .\, rdivide, ./, and power, .^ operate element-wise.
x = 1:5
y = x + 2 % Add 2 to each element of x
z = y .* x % Multiply each element of y by the corresponding element of x
a = z - 3 % Subtract 3 from each element of z
b = x ./ y % Divide each element of x by the corresponding element of y
c = b .^ 2 % Raise each element of b to the power of 2
Use these operators to perform calculations on all elements of your matrix at once.
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!