clear all
close all
clc
format short eng
R1=100;
R2=100;
R3=500;
R4=100;
R5=50;
C1=1e-6;
C2=1e-6;
C3=2e-6;
syms s Vin Va Vb Vc Vd Ve Vf C1 C2 C3 R1 R2 R3 R4 R5 Vout
Zc1=1/(s*C1);
Zc2=1/(s*C2);
Zc3=1/(s*C3);
e(1)=Vin==Va; %KVL Op Amp
e(2)=Ve==Vf;
e(4)=((Va-Vb)/Zc1)-((Vb-Vd)/Zc2)-(Vb/R5)==0; % KCL Node B
e(5)=((Va-Vc)/R1)-((Vc-Vd)/R2)-((Vc-Ve)/Zc3)==0; %KCL Node C
e(6)=((Vb-Vd)/Zc2)-((Vc-Vd)/R2)==0; %KCL Node D
e(7)=((Vc-Ve)/Zc3)-((Ve-Vf)/R3)==0; %KCL Node E
e(8)=((Ve-Vf)/R3)-(Vf/R4)==0; %KCL Node F
sol=solve(e,Va,Vb,Vc,Vd,Ve,Vf,Vout); %Sol
Vout=sol.Vf/R5+R4;
Vout=eval(sol.Vout)
H=Vout/Vin % Gain is output over input
Transfer function keeps coming up as empty
154 Views Asked by Julio Acosta-Silverio At
1
You can't define resistors
R1 R2 R3 R4 R5
as symbols when you already have their values, they got overwritten. Same for capacitors,C2 C3
, and give some value forVin
in order to get value for Vout. Also, don't put the equations as a vector against variables,Vout
is not a variable. just write the equations individually and leave the variables for MATLAB to determine automatically. Finally check the formula forVout = Vf/R5 + R4
, is it accurate?Output: