close all;
clear all;
clc;
%{
vx=-2.5:0.05:2;
vy=vx-vx.^3/3;
wx=vx;
wy=(wx+0.7)./0.8;

figure;
subplot(2,1,1);
plot(vx,vy,'-');
hold on;
plot(wx,wy);
xlim([-2.5 2]);
ylim([-1.5 1.5]);

% egyensúlyi pont környékét vizsgál
 for i=1:20
     x0=[-1.2 -0.625]+0.3*randn(1,2);
     t0=[0 50];
     [t, phi]=ode45(@(t,x)fnode_ora(t,x),t0,x0);
     subplot(2,1,1);
     hold on
     plot(phi(:,1),phi(:,2),'r');
     plot(x0(1), x0(2), 'mx')
     title(['kezdõpont: ', num2str(x0)]);
     subplot(2,1,2);
     hold on
     plot(t,phi(:,1));
     waitforbuttonpress;
 end
%}
%{
figure;
 for i=1:10
     x0=[-1.2 -0.625-0.001*i];
     t0=[0 50];
     [t, phi]=ode45(@(t,x)fnode_ora(t,x),t0,x0);
     subplot(2,1,1);
      xlim([-1.202 -1.185]);
     ylim([-0.64 -0.62]);
     hold on
     plot(phi(:,1),phi(:,2),'r', x0(1), x0(2), 'mx');
     
     vx=-2.5:0.05:2;
     vy=vx-vx.^3/3;
     wx=vx;
     wy=(wx+0.7)./0.8;
     plot(vx,vy,'-b', wx,wy, '-b');
     title(['kezdõpont: ', num2str(x0)]);
     
     subplot(2,1,2);
     xlim([0 50]);
     ylim([-1.202 -1.185]);
     hold on
     plot(t,phi(:,1));
     waitforbuttonpress;
 end
%}
 
%{
%görbét tologatom
figure;
for I=0:0.1:2
 %I=0.5;
 
 vx=-2.5:0.05:3;
 vy=vx-vx.^3/3+I;
 wx=vx;
 wy=(wx+0.7)./0.8;
 
 subplot(2,1,1);
 plot(vx,vy);
 hold on;
 plot(wx,wy);
 xlim([-2.5 3]);
 ylim([-1.5 6]);
 title(['eltolás: ', num2str(I)]);
 
 x0=[-1 -1];
 t0=[0 150];
 
 [t, phi]=ode45(@(t,x)fnode2_ora(t,x,I),t0,x0);
     subplot(2,1,1);
     %hold on
     plot(phi(:,1),phi(:,2),'r');
     hold off;
     subplot(2,1,2);
     %hold on
     plot(t,phi(:,1));
     waitforbuttonpress;
end
%}

%
%% Hiperpolarizáció
figure;
for x1=-2:0.1:0
vx=-2.5:0.05:2;
vy=vx-vx.^3/3;
wx=vx;
wy=(wx+0.7)./0.8;

hip=50;
t0=[0 150];
x0=[x1 -0.625-0.6]%[-1.04 -0.625-0.6]
[t, phi]=ode45(@(t,x)fnode3_ora(t,x, hip),t0,x0);
subplot(2,1,1);
hold on
plot(phi(:,1),phi(:,2),'r');
plot(vx,vy,'-');
plot(wx,wy);
title(['kezdõpont: ', num2str(x0)]);
subplot(2,1,2);
hold on
plot(t,phi(:,1));
waitforbuttonpress;
end
%}


