Effacer les filtres
Effacer les filtres

I'm getting a blank graph.

2 vues (au cours des 30 derniers jours)
Vishal Antony
Vishal Antony le 9 Oct 2018
I have a 4DOF, forced, damped linearized system. I trying to calculate the the forced response of the system. I'm getting the numerical values, I have checked this by printing the matrices. But I'm getting a blank graph. Below is the code I have written.
function forcedResponse
kxx = 200e6;
kyy = 150e6;
kxy = 15e6;
kyx = 10e6;
cxx = 200e3;
cyy = 150e3;
cyx = 13e3;
cxy = 18e3;
l = 1;
d = 0.05;
rho = 7800;
ez = 0.001;
e = 0.0001;
m = 0.25*pi*d^2*l*rho;
Id = (m/12)*(0.75*d^2 + l^2);
M = [m 0 0 0
0 m 0 0
0 0 Id 0
0 0 0 Id];
C = [2*cxx 2*cxy 0 0
2*cyx 2*cyy 0 0
0 0 0.5*l^2*cxx 0.5*l^2*cxy
0 0 0.5*l^2*cyx 0.5*l^2*cyy];
K = [2*kxx 2*kxy 0 0
2*kyx 2*kyy 0 0
0 0 0.5*l^2*kxx 0.5*l^2*kxy
0 0 0.5*l^2*kyx 0.5*l^2*kyy];
hold on;
for w = 1:10 % w is angular speed
D = -w^2*M + 1i*w*C + K % D is 4by4 matrix, M is mass matrix, C is damping matrix, K is stiffness matrix
Fx = m*e*w^2;
Fy = -1i*m*e*w^2;
Mxz = m*e*w^2*ez;
Myz = -1i*m*e*w^2*ez;
F = [Fx; Fy; Mxz; Myz]; %force amplititude. It's 4by1 vector
X = D\F; %displacement amplitude. contains complex elements
plot(w,abs(X(1)))
end
xlabel('spin speed (rad/s)'), ylabel('Amplitude of translational displacement (m)')
title('X v \omega')
end

Réponse acceptée

Miriam
Miriam le 9 Oct 2018
You are trying to plot a line using single points. If you would like them to show up, consider using
plot(w,abs(X(1)),'o');
as opposed to
plot(w,abs(X(1)));
If you would like a line connecting these points, save each value of X in a vector and plot after completing the loop.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by