Created
June 18, 2018 00:30
-
-
Save leomariga/89e99009fcd22b3e4e0bf2e28072b01e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = figure; | |
global a | |
global b | |
if isempty(a) | |
a=1; | |
end | |
if isempty(b) | |
b=1; | |
end | |
slider1 = uicontrol('Parent',f,'Style','slider','Position',[81,65,419,23],... | |
'value',1, 'min',0, 'max',10); | |
bgcolor = f.Color; | |
slider2 = uicontrol('Parent',f,'Style','slider','Position',[550,65,419,23],... | |
'value',1, 'min',0, 'max',10); | |
slider1.Callback = @(es,ed) slider_plot(es, ed, get(es,'value'), b, f); | |
slider2.Callback = @(es,ed) slider_plot(es, ed, a, get(es,'value'), f); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slider_plot(es, ed, alpha, beta, f) | |
global a | |
global b | |
display(alpha) | |
display(beta) | |
a = alpha; | |
b=beta; | |
x1 = linspace(-3,3,50); | |
x2 = linspace(-3,3,50); | |
[x1,x2] = meshgrid(x1,x2); | |
x1p = -x1 - x2.*x2.*x2; | |
x2p = x1; | |
quiver(x1,x2,x1p,x2p,5); | |
hold on | |
x1 = linspace(-3,3,1000); | |
x2 = linspace(-3,3,1000); | |
[x1,x2] = meshgrid(x1,x2); | |
V = 4*a*x1.*x1.*x1+2*b*x1+x2; | |
Vponto = -4*a*x1.*x1.*x1.*x1+(1-2*b)*x1.*x1+x1.*x2-4*a*x1.*x1.*x1.*x2.*x2.*x2-2*b*x1.*x2.*x2.*x2-x2.*x2.*x2.*x2 ; | |
%V = 4*a*x1.*x1.*x1+2*b*x1+x2; | |
%Vponto = (4*a-2)*x1.*x1.*x1.*x2+(2*b-1)*x1.*x2-x2.*x2-x1.*x1.*x1.*x1; | |
colormap(colorcube) | |
contour(x1,x2,Vponto<0,1, 'LineWidth',4) | |
colormap(hot) | |
contour(x1,x2,V,100) | |
axis([-3 3 -3 3]) | |
hold off | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment