フィルターのクリア

Previous matrix numbers in the formula and creating a new matrix

3 ビュー (過去 30 日間)
Emilia
Emilia 2022 年 7 月 24 日
編集済み: Torsten 2022 年 7 月 24 日
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

採用された回答

Steven Lord
Steven Lord 2022 年 7 月 24 日
The arithmetic operators plus, +, minus, -, times, .*, ldivide, .\, rdivide, ./, and power, .^ operate element-wise.
x = 1:5
x = 1×5
1 2 3 4 5
y = x + 2 % Add 2 to each element of x
y = 1×5
3 4 5 6 7
z = y .* x % Multiply each element of y by the corresponding element of x
z = 1×5
3 8 15 24 35
a = z - 3 % Subtract 3 from each element of z
a = 1×5
0 5 12 21 32
b = x ./ y % Divide each element of x by the corresponding element of y
b = 1×5
0.3333 0.5000 0.6000 0.6667 0.7143
c = b .^ 2 % Raise each element of b to the power of 2
c = 1×5
0.1111 0.2500 0.3600 0.4444 0.5102
Use these operators to perform calculations on all elements of your matrix at once.
  3 件のコメント
Torsten
Torsten 2022 年 7 月 24 日
編集済み: Torsten 2022 年 7 月 24 日
B = (A-1)*15/11
Emilia
Emilia 2022 年 7 月 24 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by