subplot in for loop is not working
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
mehra
el 3 de En. de 2020
Comentada: mehra
el 3 de En. de 2020
Hello
I want to use and plot the following code
plot(u_c(:,3),y_c)
hold on
plot(u_w(:,3),y_w)
But I need to use subplot because of the number of data sets.so I used the following code and put subplot in the for-loop
for ww=1:13;
subplot(2,13,ww);
plot(u_c(:,ww),y_c,'k')
hold on
plot(u_w(:,ww),y_w,'r')
xlabel('$y/D$','interpreter','latex')
ylabel('$u$','interpreter','latex')
xlim([-0.2 0.2])
ylim([0 0.7])
end
the problem is that when ı use the plot command it gives good results (for one data set) but the loop doesnt shows the correct results.
it seems that there is a mistake that ı would be so thankful if someone help me about it.
the required files are attached.
0 comentarios
Respuesta aceptada
David Hill
el 3 de En. de 2020
for ww=1:13
subplot(2,13,ww);
plot(u_w(:,ww),y_w,'r',u_c(:,ww),y_c,'k')
xlabel('$y/D$','interpreter','latex')
ylabel('$u$','interpreter','latex')
xlim([-0.2 0.2])
ylim([0 3])
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!