Making a line thought points plotted from for loop in MATLAB
1 view (last 30 days)
Show older comments
Siddhi Kadam
on 20 Oct 2021
Commented: Siddhi Kadam
on 20 Oct 2021
I am trying to connect the data points that are obtained from the following code, but am not able to. How do I connect the points?
clc;
clear all
R1= 1399.580e+6;
C1= 374.868e-6;
R2= 1497.005e+6;
C2= 350.472e-6;
R3= 19573.407e+6;
C3= 2429.373e-12;
R0= 1354.967e+6;
C0= 15.94e-9;
hold on
for f =[0.001 0.005 0.01 0.05 0.1 0.5 1 5 10 50 100 500 1000]
W = 2*pi*f;
Cr=(C0)+(C1)/(1+(W*R1*C1)^2)+(C2)/(1+(W*R2*C2)^2)+(C3)/(1+(W*R3*C3)^2);
Ci=1/(W*R0)+(W*R1*C1^2)/(1+(W*R1*C1)^2)+(W*R2*C2^2)/(1+(W*R2*C2)^2)+(W*R3*C3^2)/(1+(W*R3*C3)^2);
tan_del = Ci/Cr
f
set(gca, 'XScale', 'log')
plot([f],[tan_del],'-x','linewidth',10)
xlabel('Freq in log')
ylabel('tan_del in lin')
line(f,tan_del,'Color', 'r','linewidth',10)
end
hold off
0 Comments
Accepted Answer
Alan Stevens
on 20 Oct 2021
Like this?
R1= 1399.580e+6;
C1= 374.868e-6;
R2= 1497.005e+6;
C2= 350.472e-6;
R3= 19573.407e+6;
C3= 2429.373e-12;
R0= 1354.967e+6;
C0= 15.94e-9;
f =[0.001 0.005 0.01 0.05 0.1 0.5 1 5 10 50 100 500 1000];
W = 2*pi*f;
Cr=(C0)+(C1)./(1+(W*R1*C1).^2)+(C2)./(1+(W*R2*C2).^2)+(C3)./(1+(W*R3*C3).^2);
Ci=1./(W*R0)+(W*R1*C1^2)./(1+(W*R1*C1).^2)+(W*R2*C2^2)./(1+(W*R2*C2).^2)+(W*R3*C3^2)./(1+(W*R3*C3).^2);
tan_del = Ci./Cr;
semilogx(f,tan_del,'x',f,tan_del,'r')
xlabel('Freq in log')
ylabel('tan_del in lin')
More Answers (0)
See Also
Categories
Find more on Axis Labels 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!