Advertisement
Guest User

Untitled

a guest
Oct 29th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.77 KB | None | 0 0
  1. %% C++ Shape Function Plot.
  2.  
  3.  
  4. % Pre-Processing
  5. clear all;close all;clc
  6.  
  7. % Create Plot
  8. x=-20:.1:20;
  9. y=x;
  10. z=x;
  11. [X,Y,Z]=meshgrid(x,y,z);
  12. % our_function = @(x,y,z) (sqrt(x.^2+y.^2+z.^2)<10); % Example
  13. our_function = @(x,y,z) (z*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0); % Shape Function 1 Simplified
  14. our_function = @(x,y,z) (z*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0)&&(x.^2>0.01*15*15)&&(z>-2.3*15)
  15.                                                                             % Shape Function 1
  16.                                                                             % Extended
  17.  
  18. B=our_function(X,Y,Z);
  19. [X,Y,Z]=meshgrid(x,y,z);
  20.  
  21. p = patch(isosurface(X,Y,Z,B,0));
  22. set(p,'FaceColor','red','EdgeColor','none');
  23. daspect([1,1,1])
  24. view([0,45]);
  25. camlight;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement