Where does my impedance problem come from?

조회 수: 2 (최근 30일)
damien bertein
damien bertein 2018년 6월 5일
답변: Kim Winter 2018년 7월 3일
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