Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- x=linspace(-2,0.1,2);
- y=linspace(-2*pi,0.2,2*pi);
- [X,Y]=meshgrid(x,y);
- Z=(sin(X).^5).*(abs((cos(Y)).^3));
- figure(1)
- subplot(3,3,[1,4,7])
- meshc(X,Y,Z)
- xlabel('X')
- ylabel('Y')
- zlabel('Z')
- colorbar
- X=2;
- Z=(sin(X).^5).*(abs((cos(Y)).^3));
- a_ros=[];
- a_mal=[];
- for i=1:length(Z)-1
- if Z(i)>Z(i+1)
- a_mal=[a_mal i]
- elseif Z(i)<Z(i+1)
- a_ros=[a_ros i]
- else
- end
- end
- subplot(3,3,[2,5,8])
- plot(y,Z,'b' ,'LineWidth', 2)
- hold on
- plot(y(a_mal),Z(a_mal),'bd')
- hold on
- plot(y(a_ros),Z(a_ros),'rd')
- legend(['Z=f(X,y), dla Z=2', 'Z_mal', 'Z_ros'])
- grid on
- a_min=[];
- a_max=[];
- for i=2:length(Z)-1
- if Z(i)>Z(i+1)& Z(i)>Z(i-1)
- a_max=[a_min i]
- elseif Z(i)<Z(i+1)& Z(i)<Z(i-1)
- a_min=[a_min i]
- end
- end
- subplot(3,3, [3,6,9])
- plot(y,Z,'b' ,'LineWidth', 2)
- hold on
- plot(y(a_max),Z(a_max),'bo' ,'LineWidth', 2,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', 8)
- hold on
- plot(y(a_min),Z(a_min),'bo' ,'LineWidth', 2,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', 8)
- a_i1=[];
- a_i2=[];
- ZZ=Z;
- for i=1:length(Z)
- if Z(i)>= -2.5;
- ZZ(i)==-2.5;
- a_i1=[a_i1 i];
- elseif Z(i)<= -2.5
- ZZ(i)==Z(i).^2;
- a_i2=[a_i2 i];
- end
- end
- subplot(3,3, [6,9])
- plot(y,Z,'b' ,'LineWidth', 2)
- hold on
- plot(y(a_i1),Z(a_i1),'bo' ,'LineWidth', 1,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', 8)
- hold on
- plot(y(a_i2),Z(a_i2),'bo' ,'LineWidth', 1,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', 8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement