I cant get the correct plotting
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abdullah Alsayegh
am 28 Mär. 2023
Kommentiert: Torsten
am 28 Mär. 2023
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
0 Kommentare
Akzeptierte Antwort
Torsten
am 28 Mär. 2023
Bearbeitet: Torsten
am 28 Mär. 2023
% 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)
xlabel('Frequency [Hz]', 'fontsize', 15)
ylabel('phase [deg]', 'fontsize', 15)
grid on
2 Kommentare
Torsten
am 28 Mär. 2023
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!