How can I solve an equation with 4 vectors of unequal length?

1 回表示 (過去 30 日間)
pocklepeter
pocklepeter 2021 年 10 月 9 日
コメント済み: pocklepeter 2021 年 10 月 9 日
How do I use an equation to show the possible soloutions if I have four variables as arrays of different lengths?
Can I use increments that don't fit nicely into the end value - eg: if I start at 1 and want to get to 8 can I increment in 3's?
%constants
g = 9.80665;
%variables in the design
mb = 1:0.5:20; % From 1 to 20 in increments of 0.5
r = 0.01:0.01:0.15; % From 0.01 to 0.15 in increments of 0.01
omega = 1800:1000:20000; % From 1,800 to 20,000 in increments of 1,000
omegarad = omega*2*pi/60; % to change rpm to radians
h = 0.01:0.1:1; % From 0.01 to 1 in increments of 0.1
mw = 2*mb.*g*h./((r.*omegarad).^2);

採用された回答

David Hill
David Hill 2021 年 10 月 9 日
編集済み: David Hill 2021 年 10 月 9 日
Use ndgrid()
g = 9.80665;
mb = 1:0.5:20;
r = 0.01:0.01:0.15;
omega = 1800:1000:20000;
omegarad = omega*2*pi/60;
h = 0.01:0.1:1;
[mb,r,omegarad,h]=ndgrid(mb,r,omegarad,h);
mw = 2*g*mb.*h./((r.*omegarad).^2);%this provides all combinations of the four variables
What are you trying to solve? Do you want mw==something?
  1 件のコメント
pocklepeter
pocklepeter 2021 年 10 月 9 日
This worked, thank you.
I guess I am looking at my problem wrong as I would like to see what combination of variables produce which results of mw.
I'm trying to design something which will produce a certain force, so I'd like to see what combination of characteristics are the most acheivable.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by