フィルターのクリア

How do I use an indicator variable to select one of these 4 equations?

2 ビュー (過去 30 日間)
Kylenino Espinas
Kylenino Espinas 2020 年 9 月 29 日
回答済み: Samiu Haque 2020 年 9 月 29 日
var1 = double;
var2 = double;
indicator =
A = var1 * var2;
%var 1 and var 2 are the sides
Vcylinder = var1 * pi * var2^2;
%var 1 is the heigth and var 2 is the radius
Vpyramid = var1^2 * var2/h;
%var 1 is the length and var 2 is the height
Vcone = pi * var1^2 * (var2/3);
%var 1 is the radius and var 2 is the height
This is what I have right now and I have to use my 2 inputs for any of the other equations using an indicator.

回答 (1 件)

Samiu Haque
Samiu Haque 2020 年 9 月 29 日
You can use 'switch' statement, like selecting required option as 1,2,3. There may have some other methods which I am not aware of.

カテゴリ

Help Center および File ExchangeExponents and Logarithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by