Where does my impedance problem come from?

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

Antworten (1)

Kim Winter
Kim Winter am 3 Jul. 2018

0 Stimmen

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.

Kategorien

Mehr zu Acoustics, Noise and Vibration finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017a

Gefragt:

am 5 Jun. 2018

Beantwortet:

am 3 Jul. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by