フィルターのクリア

Equations with Variables & User input

3 ビュー (過去 30 日間)
Emma Sellers
Emma Sellers 2019 年 10 月 14 日
回答済み: darova 2019 年 10 月 14 日
Hi!
I am attempting to write a program that analyzes a circuit that is decribed with user input.. My attempt is to get the user input and create a system of equations from that input.. But I am unsure how to get equations with variables that I am solving for in matlab..
Doing by hand I would end up with something like, (v1-v2)/5 + (v2-v3)/10= 1
and then I would need it to be 0.2v1-0.1v2-0.1v3=1
Any ideas on how to get matlab to do that?
Will it work if I use the Syms function for the variables I am solving for?
Thanks!

採用された回答

darova
darova 2019 年 10 月 14 日
Use coeffs
syms x y z
eqn = (x + 2*y + 10*z)/2;
[c,t] = coeffs(eqn)
sum(c.*t)
Also try
simplify(eqn)

その他の回答 (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