How to substitute a variable into a syms function?

1 回表示 (過去 30 日間)
Aditya Zade
Aditya Zade 2024 年 5 月 28 日
コメント済み: Aditya Zade 2024 年 5 月 28 日
I would like to substitute terms "Lp * Cps * ws^2" as "Kp" in the following B0. How could that be done?
syms Vpo Von Dp Dn ws Lp Cps Ll Lm Vsecm Isec_real Isec_imag Isec_abs Thetasec Ix_real Ix_imag Ix_abs Kp Kl Km real
Kp = Lp * Cps * ws^2;
B0 = Cps^2*Ix_abs*Lp^3*ws^9*(- Lm*ws*Isec_abs^2 + Isec_imag*Vsecm*cos(Thetasec) + Isec_real*Vsecm*sin(Thetasec));

採用された回答

Dyuman Joshi
Dyuman Joshi 2024 年 5 月 28 日
Define the variable as a symbolic variable and then substitute -
syms Vpo Von Dp Dn ws Lp Cps Ll Lm Vsecm Isec_real Isec_imag Isec_abs Thetasec Ix_real Ix_imag Ix_abs Kp Kl Km real
%Kp = Lp * Cps * ws^2;
B0 = Cps^2*Ix_abs*Lp^3*ws^9*(- Lm*ws*Isec_abs^2 + Isec_imag*Vsecm*cos(Thetasec) + Isec_real*Vsecm*sin(Thetasec))
B0 = 
%Definition
syms Kp
%Substition
B0 = subs(B0, Lp * Cps * ws^2, Kp)
B0 = 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Variables, Expressions, Functions, and Preferences についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by