Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = -1 : 0.01 : 1;
- y = 1./(25*(x.^2) + 1);
- plot(x, y, 0, 1, 'r*');
- [x, y] = meshgrid(-10:0.5:10, -10:0.5:10);
- z = @(a,b) a.^2+b.^2;
- subplot(2,1,1);
- surf(x, y, z(x, y));
- hold on
- colormap(hot);
- plot3(0,0,z(0,0), 'g*', 'MarkerSize', 100);
- subplot(2,1,2);
- [C, h] = contour(x,y,z(x,y));
- %axis('square');
- dx = [-5, -2, -2, 0];
- dy = [-3, -3, 0, 0];
- hold on;
- plot(dx(1), dy(1), 'r*');
- text(dx(1), dy(1), 'START');
- hold on;
- plot(dx(4), dy(4), 'g*');
- text(dx(4), dy(4), 'STOP');
- hold on;
- plot(dx(2:end-1), dy(2:end-1), 'go');
- hold on;
- for i = 1 : 3
- line([dx(i), dx(i+1)], [dy(i) , dy(i+1)]);
- end
- clabel(C, h);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement