plot2D.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. function plot2D
  2. % trace du maillage d'une structure plane
  3. % avec les numero des noeuds et des elements
  4. % les conditions aux limites (deplacements imposes)
  5. % et les Charges nodales
  6. %
  7. % appel plot2D
  8. %
  9. % H.Oudin
  10. global nddln nnod nddlt nelt nnode ndim
  11. global Coord Connec Ncl F
  12. hold on
  13. title('maillage de la structure')
  14. axis equal
  15. XY = Coord;
  16. Cu = Ncl(1:nddln:nddlt); Cv = Ncl(2:nddln:nddlt);
  17. Fx = F(1:nddln:nddlt); Fy = F(2:nddln:nddlt);
  18. if ndim == 1
  19. XY(:,2) = zeros(nnod,1);
  20. if (nddln == 1) Cv = zeros(nnod,1); Fy = zeros(nnod,1); end
  21. end
  22. for inod=1:nnod % ----- Noeuds , conditions aux limites et charges nodales
  23. text(XY(inod,1),XY(inod,2),[' ',int2str(inod)],'color','m','FontSize',14)
  24. if Cu(inod)==1 plot(XY(inod,1),XY(inod,2),'>','color','k','MarkerSize',10);end
  25. if Cv(inod)==1 plot(XY(inod,1),XY(inod,2),'^','color','k','MarkerSize',10);end
  26. if Fx(inod)~= 0
  27. text(XY(inod,1),XY(inod,2),[' \rightarrow',num2str(Fx(inod))],...
  28. 'HorizontalAlignment','left','color','g','FontSize',14);
  29. end
  30. if Fy(inod)~= 0
  31. text(XY(inod,1),XY(inod,2),['\uparrow',num2str(Fy(inod))],...
  32. 'VerticalAlignment','bottom','color','g','FontSize',14);
  33. end
  34. end
  35. plot(XY(:,1),XY(:,2),'.','color','m','MarkerSize',12);
  36. for iel = 1:nelt %----- visualisation du maillage
  37. loce=[]; %----- table de localisation pour l'element
  38. for i=1:nnode
  39. if Connec(iel,i) > 0 loce=[loce,Connec(iel,i)]; end
  40. end;
  41. Pos = XY(loce,:);
  42. X = [[Pos(:,1)]; Pos(1,1)];Y = [[Pos(:,2)]; Pos(1,2)];
  43. line(X,Y,'color','b')
  44. text(mean(Pos(:,1)),mean(Pos(:,2)),[' ',int2str(iel)],'color','b','FontSize',14)
  45. end
  46. return