Use Matlab to simplify equation
Show older comments
I was trying to simplify the following equation into the format of Vout equals something. The V1 and V2 are expected to be removed in the final answer. I tried the following code below but it doesn't work. May I ask if I can use matlab to do this or I have to do it by hand? If I have to do it by hand, may I ask if I can have some kind of help by matlab with some of the procedures?
syms C2 R5 R4 R6 C1 R1 R2 R3 V1 V2 Vin Vout f Vref
equ1 = (V2 - V1) * f * C2 * 2 * pi == (V1 - Vout)/R1;
equ2 = (Vin - V1) * f * C2 * 2 * pi == (V1 - Vref)/R6 + (V1 - V2)/R4 + (V1 - Vin)/R5;
equ3 = (Vout - V1)/R2 == (V1 - Vin)/R3;
simplify([equ1,equ2,equ3])
vpasolve([equ1,equ2,equ3],Vout)
Answers (1)
You have three equations and two variables to eliminate. Solve any two of the equations for the two variables, and substitute the results back into the equations.
Caution: this process cannot promise that the third equation will be consistent with the first two.
syms C2 R5 R4 R6 C1 R1 R2 R3 V1 V2 Vin Vout f Vref
equ1 = (V2 - V1) * f * C2 * 2 * pi == (V1 - Vout)/R1;
equ2 = (Vin - V1) * f * C2 * 2 * pi == (V1 - Vref)/R6 + (V1 - V2)/R4 + (V1 - Vin)/R5;
equ3 = (Vout - V1)/R2 == (V1 - Vin)/R3;
sol = solve([equ1, equ2], [V1, V2]);
out = subs([equ1; equ2; equ3], sol)
Categories
Find more on Matrix Indexing 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!
