Making a line thought points plotted from for loop in MATLAB
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Alan Stevens
2021-10-20
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')
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!