MATLAB: Piloting log in y cordinate

plot

format shortG
kxx = 2.0e4; kyy = 8.8e4;
kxy = 1.0e3; kyx = 1.5e3;
cxx = 1.0 ; cyy = 1.0; cxy = 1.0e-1;
cyx = 1.0e-1;
l=2; m=5; id=0.1;
er=0.13-3; ez=1e-3; mu=0.02;
i = sqrt(-1);
syms w
stiffnes_matrix=[kxx kyy 0 0; kyx kyy 0 0; 0 0 0.25*l^2*kxx 0.25*l^2*kxy;0 0 0.25*l^2*kyx 0.25*l^2*kyy];
mass_matrix=[m 0 0 0; 0 m 0 0; 0 0 id 0; 0 0 0 id];
force_unblance=[mu*er*w^2; -i*mu*er*w^2; mu*er*w^2*ez; -i*mu*er*w^2*ez];
D=stiffnes_matrix-(w^2*mass_matrix);
xss=inv(D)*force_unblance
p1=xss(1,1)
p2=xss(2,1)
p3=xss(3,1)
p4=xss(4,1)
set(gca, 'YScale', 'log')
w = linspace(0,1200)';
plot(p1,w)
plot(p2,w)
plot(p3,w)
plot(p4,w)
i want to drwa but this error appear
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.

Best Answer

Hi,
try:
format shortG
kxx = 2.0e4; kyy = 8.8e4;
kxy = 1.0e3; kyx = 1.5e3;
cxx = 1.0 ; cyy = 1.0; cxy = 1.0e-1;
cyx = 1.0e-1;
l=2; m=5; id=0.1;
er=0.13-3; ez=1e-3; mu=0.02;
i = sqrt(-1);
syms w
stiffnes_matrix=[kxx kyy 0 0; kyx kyy 0 0; 0 0 0.25*l^2*kxx 0.25*l^2*kxy;0 0 0.25*l^2*kyx 0.25*l^2*kyy];
mass_matrix=[m 0 0 0; 0 m 0 0; 0 0 id 0; 0 0 0 id];
force_unblance=[mu*er*w^2; -i*mu*er*w^2; mu*er*w^2*ez; -i*mu*er*w^2*ez];
D=stiffnes_matrix-(w^2*mass_matrix);
xss=D\force_unblance;
fun_xss = matlabFunction(xss);
clear w
w = linspace(0,1200);
p_all=fun_xss(w);
subplot(2,2,1)
semilogy(w,abs(p_all(1,:)))
subplot(2,2,2)
semilogy(w,abs(p_all(2,:)))
subplot(2,2,3)
semilogy(w,abs(p_all(3,:)))
subplot(2,2,4)
semilogy(w,abs(p_all(4,:)))
results in:
plot-4.PNG
Best regards
Stephan
Related Question