フィルターのクリア

Solving Equaiton with multplying power

1 回表示 (過去 30 日間)
jack london
jack london 2022 年 1 月 15 日
編集済み: Walter Roberson 2022 年 1 月 17 日
I have a equation given below, I need to solve this equaiton in matlab and find base X,Y,Z . There is solution given.
In matlab, I try to setup base but I cant figure out exactly. How I setup this equation in Matlab ? Thanks for help.
My matlab code for design base of the equation :
clear; clc;
[0 1 1^-1 ] % B*C^(-1)
[0 1 0] % B
[1 1^-3 0] %A*B^-3
[0 1^3 1^-1] %B^3*C^-1

採用された回答

Walter Roberson
Walter Roberson 2022 年 1 月 15 日
syms A B C
syms X Y Z integer
eqn = (B*C^-1)^X * (B)^Y * (A*B^-3)^Z * (B^3*C^-1) == A^0*B^0*C^0
eqn = 
seqn = simplify(lhs(eqn)) == simplify(rhs(eqn))
seqn = 
collect(lhs(seqn),C)
ans = 
powers = findSymType(ans, 'power')
powers = 
need_to_solve = arrayfun(@(expression) children(expression,2), powers)
need_to_solve = 
syms X Y Z %remove assumptions
sol = solve(need_to_solve)
sol = struct with fields:
X: -1 Y: -2 Z: 0
  4 件のコメント
jack london
jack london 2022 年 1 月 17 日
Hi again,
When I run code on my matlab R2021a the output is:
Gıves this format, how I convert to numeric values (X=-1 Y=-2 Z=0)
Walter Roberson
Walter Roberson 2022 年 1 月 17 日
編集済み: Walter Roberson 2022 年 1 月 17 日
X = double(sol.X)
Y = double(sol.Y)
Z = double(sol.Z)
Remember though that if you are using displayFormula, then what it prefers is character values -- which would be from char(sol.X) or string(sol.X) rather than double(sol.X)

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

その他の回答 (1 件)

Matt J
Matt J 2022 年 1 月 15 日
編集済み: Matt J 2022 年 1 月 15 日
LHS=[0 0 1;
-1 0 0;
1 1 -3];
RHS=[0;1;-3];
XYZ=LHS\RHS
XYZ = 3×1
-1 -2 0
  1 件のコメント
jack london
jack london 2022 年 1 月 16 日
Thansk for answer.
I dont understant what represents LHS and RHS, could you give more detail please

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by