Connecting Dots in a plot

2 visualizaciones (últimos 30 días)
Marcelo Boldt
Marcelo Boldt el 16 de Jul. de 2020
Comentada: Marcelo Boldt el 16 de Jul. de 2020
Hello everyone!
I have 1 Vector (8x1 dimension) and 1 Array (3x1x8 dimension) and I want to connect each number of the vector with first element of each vector that belong to the array (this would mean 1x1x8)
My script works but I am struggling to connect the each point with a line, Can you help me ?
Here is my extract of code:
for i = 1:Nplies
zbar(i,1) = -(h + t)/2 + i*t;
theta = thetadb(i) * pi / 180;% ply i angle in radians, from bottom
theta_global(i,1) = thetadb(i);
c = cos(theta);
s = sin(theta);
T = [ c^2 s^2 -2*c*s; s^2 c^2 2*c*s; c*s -c*s (c^2 - s^2)];
T_inv = [c^2 s^2 c*s; s^2 c^2 -c*s; -2*c*s 2*c*s (c^2 - s^2)];
Qbar = T * Q * T_inv; %transformed reduced stiffness matrix
NT(:,:,i) = NTi + Qbar * abar * t * deltaT;
NT_plot(:,:,i) = NTi + Qbar * abar * t * deltaT;
figure(2)
plot (NT_plot(1,:,i),zbar(i,1),'dr')
xlabel('Loads in X')
ylabel ('Laminate Global Thickness [mm]')
legend ('NT across the Laminate')
hold on
grid on
line(NT_plot(1,:,i),zbar(i,1))
end
  4 comentarios
Arthur Roué
Arthur Roué el 16 de Jul. de 2020
Editada: Arthur Roué el 16 de Jul. de 2020
Yeah, matrix NT_plot has 3 dimension and plot function is for 2-D line plot.
I don't really understand your context, and I dont have your data. Try to plot in a loop, something like :
for dim = 1:size(NT_plot,3)
plot (NT_plot(1,:,dim), zbar(:,1), 'LineStyle', '-', 'DisplayName', num2str(dim))
end
or a 3D plot with : plot3, mesh, ...
Marcelo Boldt
Marcelo Boldt el 16 de Jul. de 2020
I could make it work! Thanks for your help, was very useful

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Single-Rate Filters en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by