Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- x=linspace(-3,3,1000);
- y=linspace (-2*pi,2*pi,500);
- [X,Y]=meshgrid(x,y);
- Z=abs((cos(X).^3)).*(abs(cos(Y)));
- figure(1)
- subplot(3,3,[1:3])
- meshc(X,Y,Z)
- xlabel('X')
- ylabel('Y')
- zlabel('Z')
- colorbar
- X=-3;
- Z=abs((cos(X).^3)).*(abs(cos(y)));
- 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,[4:6])
- 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*pi', 'Z_mal', 'Z_ros'])
- grid on
- a_i1=[];
- a_i2=[];
- ZZ=Z;
- for i=1:length(Z)
- if Z(i)>= 0.5;
- ZZ(i)==10*Z(i).^2;
- a_i1=[a_i1 i];
- elseif Z(i)<= 0.5
- ZZ(i)==Z(i);
- a_i2=[a_i2 i];
- end
- end
- subplot(3,3, [7:9])
- plot(y,Z,'b' ,'LineWidth', 2)
- hold on
- plot(y(a_i1),Z(a_i1),'bo' ,'LineWidth', 1,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', B)
- hold on
- plot(y(a_i2),Z(a_i2),'bo' ,'LineWidth', 1,...
- 'MarkerEdgeColor', 'k',...
- 'MarkerFaceColor','y',...
- 'MarkerSize', B)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement