Where does my impedance problem come from?

1 次查看(过去 30 天)
Good morning, I have a problem with my matlab code to plot my impedance module according to frequency. The problem is that I can't find my error despite the help of the documentation.
Here is my matlab code
if true
close all
clear all
pas = 10;
F= (0:pas:20000);
w= 2*pi*F;
x= w.^2;
Re= 9.54;
Le= 0.19;
Lem= 0.000011*5.07;
Rem= (5.07^2)/1.905;
Cem= 0.011/5.05;
Cer1= 5.07^2/(13.2*0.18);
Cer2= Cer1;
Z= Re+1i*w*Le+((1i*w*Lem)/(1+1i*w*(Lem/Rem)-(Cer1+Cer2+Cem)*Lem*x));
Fr= ((1/(2*pi))*(1/(Lem*(Cem+Cer1+Cer2))));
R=abs(Z);
f=(1:10:20000);
figure, loglog(f,R,'r');
xlabel('Fréquence', 'fontSize',15);
ylabel('Impédance acoustique Z', 'fontsize', 15);
end

回答(1 个)

Kim Winter
Kim Winter 2018-7-3
Hi, I believe that your issue is when you plot loglog. When you plot, for every x value, you should have a corresponding y value. If you check the lengths of f and R respectively, f is 2001 points and R is 2000 points. So, if instead, you plotted:
figure, loglog(f,R(2:end),'r');
or
figure, loglog(f,R(1:end-1),'r');
a figure will show.

类别

Help CenterFile Exchange 中查找有关 Acoustics, Noise and Vibration 的更多信息

产品


版本

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by