I cant get the correct plotting

3 ビュー (過去 30 日間)
Abdullah Alsayegh
Abdullah Alsayegh 2023 年 3 月 28 日
コメント済み: Torsten 2023 年 3 月 28 日
I am trying to acheive a specfic graph but the code is not giving me the correct respond needed. The equations are correct but not giving the specfic values needed. I assume its an issue with the loop.
% Given
p = 7500; % kg/m^3
Cd33 = 16*10^10; %N/m^2
vp= 4620; % Ns/m
Ceb = 1.43E-9; % F
phi = 2.62; % As/m
% Piezoelectric Disk Material
dia = 12e-3;
radius = dia/2;
A = pi*radius^2;
tp = 1e-3;
% Water properies for mathcing layer
pw = 1000;
cw = 1500;
vm = 3000;
f0 = vp/4*tp;
tm = vm/4*f0;
% Frequency range
f = linspace(100e3, 2.2e6,200);
alpha = 1;
% Impedence
Rrad = pw*cw*A;
Z0p = 3920; % Ns/m
% frequency range
v0e = zeros(length(f),length(alpha));
% Loop Start
for i = 1:length(alpha)
for j = 1:length(f)
w = 2*pi*f(j);
km = w/vm;
kp = w/vp;
Z0m = alpha*Rrad;
Zcem = phi^2/1j*w*Ceb;
Zm1 = 1j*Z0m*tan(km*tm/2);
Zm2 = Z0m/(1j*sin(km*tm));
Zp1 = 1j*Z0p*tan(kp*tp/2);
Zp2 = Z0p/(1j*sin(kp*tp));
Z = [Zm1+Zm2+Rrad, -Zm2, 0;
-Zm2, Zp1+Zp2+Zm1+Zm2, -Zcem;
0, -Zcem, Zcem];
v0e(j) = phi*[1 0 0]*Z^-1*[0;0;1];
end
v0e(:,i) = v0e(j);
end
figure(1)
semilogy(f, abs(v0e),'linewidth', 2)
xlabel('Frequency [Hz]', 'fontsize', 15)
ylabel('Magnitude [Ns/m]', 'fontsize', 15)
grid on
figure(2)
plot(f, (180/pi)*v0e ,'linewidth', 2)
xlabel('Frequency [Hz]', 'fontsize', 15)
ylabel('phase [deg]', 'fontsize', 15)
grid on

採用された回答

Torsten
Torsten 2023 年 3 月 28 日
編集済み: Torsten 2023 年 3 月 28 日
% Given
p = 7500; % kg/m^3
Cd33 = 16*10^10; %N/m^2
vp= 4620; % Ns/m
Ceb = 1.43E-9; % F
phi = 2.62; % As/m
% Piezoelectric Disk Material
dia = 12e-3;
radius = dia/2;
A = pi*radius^2;
tp = 1e-3;
% Water properies for mathcing layer
pw = 1000;
cw = 1500;
vm = 3000;
f0 = vp/4*tp;
tm = vm/4*f0;
% Frequency range
f = linspace(100e3, 2.2e6,200);
alpha = 1;
% Impedence
Rrad = pw*cw*A;
Z0p = 3920; % Ns/m
% frequency range
v0e = zeros(length(f),length(alpha));
% Loop Start
for i = 1:length(alpha)
for j = 1:length(f)
w = 2*pi*f(j);
km = w/vm;
kp = w/vp;
Z0m = alpha(i)*Rrad;
Zcem = phi^2/1j*w*Ceb;
Zm1 = 1j*Z0m*tan(km*tm/2);
Zm2 = Z0m/(1j*sin(km*tm));
Zp1 = 1j*Z0p*tan(kp*tp/2);
Zp2 = Z0p/(1j*sin(kp*tp));
Z = [Zm1+Zm2+Rrad, -Zm2, 0;
-Zm2, Zp1+Zp2+Zm1+Zm2, -Zcem;
0, -Zcem, Zcem];
v0e(j,i) = phi*[1 0 0]*Z^-1*[0;0;1];
end
end
figure(1)
semilogy(f, abs(v0e),'linewidth', 2)
xlabel('Frequency [Hz]', 'fontsize', 15)
ylabel('Magnitude [Ns/m]', 'fontsize', 15)
grid on
figure(2)
plot(f, (180/pi)*v0e ,'linewidth', 2)
Warning: Imaginary parts of complex X and/or Y arguments ignored.
xlabel('Frequency [Hz]', 'fontsize', 15)
ylabel('phase [deg]', 'fontsize', 15)
grid on
  2 件のコメント
Abdullah Alsayegh
Abdullah Alsayegh 2023 年 3 月 28 日
How to fix the error " Warning: Imaginary parts of complex X and/or Y arguments ignored."
Torsten
Torsten 2023 年 3 月 28 日
I guess voe is complex-valued. And MATLAB does not like to plot complex values against real values. Thus it only plots the real part of 180/pi*voe against f.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by