Bandpass filter. and transfer function plotting using matlab.
1 view (last 30 days)
Show older comments
I am having an issue with simulating transfer function and plotting magnitude.
This is my magnitude of the transfer function.
And this is my transfer function.
I have transfered this equation into a matlab with value jw = 1:1000000 and it takes too long to run the program. even 1:10:1000000 never ends.
clc;
clear;
% C = .000005; % C = 5 micro Henry = .000005 Henry
one = sym('1000 = 1/sqrt(L*C)');
two = sym('0=((R/L)*0)/(0+(R/L)*0+(1/(L*C)))');
case1 = sym('1 = (1/R)*sqrt(L/C)');
case2 = sym('3 = (1/R)*sqrt(L/C)');
case3 = sym('8 = (1/R)*sqrt(L/C)');
Q1 = solve(one,two,case1);
Q1.C;
Q1.L;
Q1.R;
Q2 = solve(one,two,case2);
Q2.C;
Q2.L;
Q2.R;
Q3 = solve(one,two,case3);
Q3.C;
Q3.L;
Q3.R;
jw = 1:10:1000000;
k1 = ((Q1.R/Q1.L).*jw)./sqrt(((1/(Q1.L*Q1.C))-(jw.^2))+((jw.^2)*(Q1.R/Q1.L)^2));
A1= 20*log10(k1);
k2 = ((Q2.R/Q2.L).*jw)./sqrt(((1/(Q2.L*Q2.C))-(jw.^2))+((jw.^2)*(Q2.R/Q2.L)^2));
A2= 20*log10(k2);
k3 = ((Q3.R/Q3.L).*jw)./sqrt(((1/(Q3.L*Q3.C))-(jw.^2))+((jw.^2)*(Q3.R/Q3.L)^2));
A3= 20*log10(k3);
k1
k2
k3
theta1= atan(((1/(Q1.L*Q1.C))-jw.^2)./((Q1.R/Q1.L).*jw));
theta2= atan(((1/(Q2.L*Q2.C))-jw.^2)./((Q2.R/Q2.L).*jw));
theta3= atan(((1/(Q3.L*Q3.C))-jw.^2)./((Q3.R/Q3.L).*jw));
figure;
semilogx(jw,A1,jw,A2,jw,A3);
xlabel('Frequency (rad/s)');
ylabel('Amplitude(dB)');
legend('Q = 1','Q = 3','Q = 8');
figure;
semilogx(jw,k1,jw,k2,jw,k3);
xlabel('Frequency (rad/s)');
ylabel('Magnitude');
legend('Q = 1','Q = 3','Q = 8');
figure;
semilogx(jw,theta1,jw,theta2,jw,theta3)
ylabel('Theta(jw)');
xlabel('Frequency (rad/s)');
legend('Q = 1','Q = 3','Q = 8');
I graphed three quality factors but graph doesn't look right.
Can somebody point me to the right direction?
function output = H(jw,R,L,C)
a= ((R/L).*jw)./((jw.^2)+(R/L).*jw+(1/(L*C)));
output = a;
0 Comments
Answers (0)
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!