フィルターのクリア

getting answers of an equation with 3 variables with known values

1 回表示 (過去 30 日間)
Shay Shah
Shay Shah 2021 年 2 月 20 日
回答済み: Viranch Patel 2021 年 7 月 9 日
I have the following equation,
function EI=GetEI(x)
E(1)=x(1);
E(2)=x(2);
E(3)=x(3);
EI=32*E(1)+E(2)/30+32*E(3);
I have the values of E1, E2 and E3, There are 12^3 (each E has 12 possible values) permutations and answers and I want to get all of the possible answers. I need help to write a code to get my values, can anyone help?
I_am_a_beginner
Thank you!
  1 件のコメント
John D'Errico
John D'Errico 2021 年 2 月 20 日
Why not try a loop? Actually, try THREE nested loops. TRY SOMETHING. If you are a beginner, this is how you will learn. And if you make and show some effort, then you might get better help.

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

回答 (1 件)

Viranch Patel
Viranch Patel 2021 年 7 月 9 日
In general you can try like this.
If E1, E2, E3 are arrays of size 12, then
for i = 1:12
for j = 1:12
for k = 1:12
EI=32*E1(i)+E2(j)/30+32*E3(k);
end
end
end
Feel free to checkout the documentation of MATLAB.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by