plotstr.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. function plotstr
  2. % trace du maillage d'une structure avec les numeros des noeuds et des elements
  3. % et les conditions aux limites (Charges nodales, deplacements imposes)
  4. %
  5. % appel plotstr
  6. % H.Oudin
  7. %==========================================================================
  8. global nddln nnod nddlt nelt nnode ndim
  9. global Coord Connec Ncl F
  10. taille = get(0,'ScreenSize');
  11. figure('Name','maillage de la structure',...
  12. 'Position',[taille(3)/2.01 taille(4)/2.4 taille(3)/2 taille(4)/2])
  13. hold on
  14. title('maillage et CL de la structure etudiee')
  15. axis equal
  16. grid on
  17. xlabel('X');
  18. ylabel('Y');
  19. zlabel('Z');
  20. XY = Coord;
  21. Cu = Ncl(1:nddln:nddlt); Cv = Ncl(2:nddln:nddlt); Cw = Ncl(3:nddln:nddlt);
  22. Fx = F(1:nddln:nddlt); Fy = F(2:nddln:nddlt); Fz = F(3:nddln:nddlt);
  23. if ndim == 1
  24. XY(:,2) = zeros(nnod,1);XY(:,3) = zeros(nnod,1);
  25. Cv = zeros(nnod,1); Fy = zeros(nnod,1);Cw = zeros(nnod,1); Fz = zeros(nnod,1);
  26. end
  27. if ndim == 2
  28. XY(:,3) = zeros(nnod,1);
  29. Cw = zeros(nnod,1); Fz = zeros(nnod,1);
  30. end
  31. for inod=1:nnod % ----- Noeuds , conditions aux limites et charges nodales
  32. text(XY(inod,1),XY(inod,2),XY(inod,3),[' ',int2str(inod)],'color','m','FontSize',14)
  33. if Cu(inod)==1 plot3(XY(inod,1),XY(inod,2),XY(inod,3),'>','color','k','MarkerSize',10);end
  34. if Cv(inod)==1 plot3(XY(inod,1),XY(inod,2),XY(inod,3),'^','color','k','MarkerSize',10);end
  35. if Cw(inod)==1 plot3(XY(inod,1),XY(inod,2),XY(inod,3),'*','color','k','MarkerSize',10);end
  36. if Fx(inod)~= 0
  37. text(XY(inod,1),XY(inod,2),XY(inod,3),[' \rightarrow',num2str(Fx(inod))],...
  38. 'HorizontalAlignment','left','color','g','FontSize',14);
  39. end
  40. if Fy(inod)~= 0
  41. %text(XY(inod,1),XY(inod,2),XY(inod,3),['\uparrow',num2str(Fy(inod))],...
  42. % 'VerticalAlignment','bottom','color','g','FontSize',14);
  43. text(XY(inod,1),XY(inod,2),XY(inod,3),['\uparrow',num2str(Fy(inod))],...
  44. 'VerticalAlignment','bottom','color','g','FontSize',14);
  45. end
  46. if Fz(inod)~= 0
  47. text(XY(inod,1),XY(inod,2),XY(inod,3),['\uparrow',num2str(Fz(inod))],...
  48. 'VerticalAlignment','bottom','color','g','FontSize',14);
  49. end
  50. end
  51. plot3(XY(:,1),XY(:,2),XY(:,3),'.','color','m','MarkerSize',12);
  52. for iel = 1:nelt %----- visualisation du maillage
  53. loce=[]; %----- table de localisation pour l'element
  54. for i=1:nnode
  55. if Connec(iel,i) > 0 loce=[loce,Connec(iel,i)]; end
  56. end;
  57. Pos = XY(loce,:);
  58. X = [[Pos(:,1)]; Pos(1,1)];Y = [[Pos(:,2)]; Pos(1,2)];Z = [[Pos(:,3)]; Pos(1,3)];
  59. line(X,Y,Z,'color','b')
  60. text(mean(Pos(:,1)),mean(Pos(:,2)),mean(Pos(:,3)),[' ',int2str(iel)],'color','b','FontSize',14)
  61. end
  62. return