フィルターのクリア

Generalize to non-dimensional formula

5 ビュー (過去 30 日間)
jack london
jack london 2022 年 1 月 22 日
編集済み: jack london 2022 年 1 月 22 日
I try to solving dimensionless problem as you can see from image.
There are three different dimensionless group(x1,y1,z1) (x2,y2,z2) and (x3,y3,z3).
I can find the corresponding values by using matlab. But I want to use while or for loop for general formula in case of adding other variable.
As can be seen from the matlab codes I use same formulas for each three dimensionless but it is long for solution I want to use only one group codes and repeat for others by this way using shorter codes I want to reach solution. Thank you.
clear all;clc;
syms M L T A
syms X Y Z X1 Y1 Z1 X2 Y2 Z2 integer
syms X3 Y3 Z3 X4 Y4 Z4 X5 Y5 Z5 integer
ds= L;
u=L*T^-1;
v=L^2*T^-1;
U=L*T^-1;
d= L;
g=L*T^-2;
p=M*L^-3;
A=v;
eqn = (u)^X1 * (d)^Y1 * (p)^Z1 * (A) == M^0*L^0*T^0;
seqn = simplify(lhs(eqn)) == simplify(rhs(eqn));
collect(lhs(seqn),T);
powers = findSymType(ans, 'power');
need_to_solve = arrayfun(@(expression) children(expression,2), powers);
syms X2 Y2 Z2 %remove assumptions;
sol =solve(need_to_solve);
X1 = double(sol.X1)
Y1 = double(sol.Y1)
Z1 = double(sol.Z1)
A=U;
eqn = (u)^X2 * (d)^Y2 * (p)^Z2 * (A) == M^0*L^0*T^0;
seqn = simplify(lhs(eqn)) == simplify(rhs(eqn));
collect(lhs(seqn),T);
powers = findSymType(ans, 'power');
need_to_solve = arrayfun(@(expression) children(expression,2), powers);
syms X2 Y2 Z2 %remove assumptions;
sol =solve(need_to_solve);
X2 = double(sol.X2)
Y2 = double(sol.Y2)
Z2 = double(sol.Z2)
A=g;
eqn = (u)^X3 * (d)^Y3 * (p)^Z3 * (A) == M^0*L^0*T^0;
seqn = simplify(lhs(eqn)) == simplify(rhs(eqn));
collect(lhs(seqn),T);
powers = findSymType(ans, 'power');
need_to_solve = arrayfun(@(expression) children(expression,2), powers);
syms X3 Y3 Z3 %remove assumptions;
sol =solve(need_to_solve);
X3 = double(sol.X3)
Y3 = double(sol.Y3)
Z3 = double(sol.Z3)

回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by