Advertisement
Guest User

1

a guest
Mar 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. close all
  2. clear all
  3.  
  4. x=linspace(-3,3,1000);
  5. y=linspace (-2*pi,2*pi,500);
  6. [X,Y]=meshgrid(x,y);
  7. Z=abs((cos(X).^3)).*(abs(cos(Y)));
  8.  
  9. figure(1)
  10. subplot(3,3,[1:3])
  11. meshc(X,Y,Z)
  12. xlabel('X')
  13. ylabel('Y')
  14. zlabel('Z')
  15. colorbar
  16.  
  17.  
  18. X=-3;
  19. Z=abs((cos(X).^3)).*(abs(cos(y)));
  20. a_ros=[];
  21. a_mal=[];
  22. for i=1:length(Z)-1
  23. if Z(i)>Z(i+1)
  24. a_mal=[a_mal i]
  25. elseif Z(i)<Z(i+1)
  26. a_ros=[a_ros i]
  27.  
  28. else
  29. end
  30. end
  31.  
  32.  
  33. subplot(3,3,[4:6])
  34. plot(y,Z,'b' ,'LineWidth', 2)
  35. hold on
  36. plot(y(a_mal),Z(a_mal),'bd')
  37. hold on
  38. plot(y(a_ros),Z(a_ros),'rd')
  39. legend(['Z=f(X,y), dla Z=2*pi', 'Z_mal', 'Z_ros'])
  40. grid on
  41.  
  42.  
  43.  
  44. a_i1=[];
  45. a_i2=[];
  46. ZZ=Z;
  47. for i=1:length(Z)
  48. if Z(i)>= 0.5;
  49. ZZ(i)==10*Z(i).^2;
  50. a_i1=[a_i1 i];
  51. elseif Z(i)<= 0.5
  52. ZZ(i)==Z(i);
  53. a_i2=[a_i2 i];
  54. end
  55. end
  56.  
  57. subplot(3,3, [7:9])
  58. plot(y,Z,'b' ,'LineWidth', 2)
  59. hold on
  60. plot(y(a_i1),Z(a_i1),'bo' ,'LineWidth', 1,...
  61. 'MarkerEdgeColor', 'k',...
  62. 'MarkerFaceColor','y',...
  63. 'MarkerSize', B)
  64. hold on
  65. plot(y(a_i2),Z(a_i2),'bo' ,'LineWidth', 1,...
  66. 'MarkerEdgeColor', 'k',...
  67. 'MarkerFaceColor','y',...
  68. 'MarkerSize', B)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement