Solving symbolic Matlab equations in term of two variables (Vo/Vi)
4 views (last 30 days)
Show older comments
syms Vx Vy Vi Vo Vg R1 R2 R3 C1 C2 C3 H k s
eqn1 = (Vx - Vi) / R1 + (Vx - Vg) / (s * C3)^-1 + (Vx - Vo) / R2 == 0
eqn2 = (Vy - Vi) / (s * C1)^-1 + (Vy - Vg) / R3 + (Vy - Vo) / (s * C2)^-1 == 0
eqn3 = (Vi - Vx) / R1 + (Vi - Vy) / (s * C1)^-1 == 0
eqn4 = (Vo - Vx) / R2 + (Vo - Vy) / (s * C2)^-1 == 0
eqn5 = Vg == 0
eqn6 = H == Vo / Vi
S = solve([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6],H)
I'm stuck been spinning my wheels for months..
I want to know H = (terms without Vx, Vy, Vi, Vo, Vg)
H is transfer function which is Voltage out / Voltage in
Honestly any help is appreciated. Thanks again.
3 Comments
Star Strider
on 26 May 2023
Post an image of the circuit.
I suspect those node-voltage equations are not set up correctly.
Answers (1)
Nathan Hardenberg
on 26 May 2023
From my experience trying to solve transfer-function with this approach did not work. If someone knows a better way please comment 😃 Not quite sure what your exact task is, but I had to get a transfer-function from a electrical filter (see diagram).
% Z1 ____
% Vi o----|____|--.----o Va
% |
% .┸.
% | | Z2
% |_|
% |
% ╧ GND
I'm not quite sure if your problem is similar, but it seems you already did some kind of laplace transform (Sorry I'm not into the topic that deep). I wrote my functions first with a symbolic variable p instead of ω. I'm guessing you also used but you seem to have a lot more voltages. Then I wrote my equation directly, without having to solve ( in my case). This still has the advantage of not having to work with long terms and it is possible to simplify the term.
Only after that, I substituted p. I used a "zero point development" or "biliniar transformation", which is probably not the way you want to tackle the problem.
Since it is very useful to have the transfer function in a specific form I wrote a function that does this afterwards.
If you want more info on the problem I worked with, I can eleborate. If not, I hope I could give you a few ideas.
And one important gerneral thing to note is that you have to tell the solve()-function what you want to solve for. That means that you have to also solve for the variables you do not want/know as well!
syms x y z a
eq1 = x^2+a*x+5 == y;
eq2 = y-a == 3;
eq3 = z+3 == y;
sol = solve([eq1; eq2; eq3], [x, y, z]);
sol.x
sol.y
sol.z
In your case this would be the following, but in my tests it did not find a result this way either.
solve([eqn1 eqn2 eqn3 eqn4 eqn5 eqn6], [H Vx Vy Vi Vo Vg])
0 Comments
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!