%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         1.gyakorlat         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nemlin. din. rsz-ek alapjai %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        2014.09.16/17        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Paraméterek:
Xinit= -9;                 % x kezdeti értéke       %
Yinit= 2;                  % y kezdeti értéke       %
tinit=0;                   % kezdeti idõ            % EZEKET A PARAMÉTEREKET ÁLLÍTHATJUK
Max_Time= 500;             % szimuláció ideje       % AZ ÜGYESEK GUI-T IS ÍRHATNAK HOZZÁ
b=0.1;                     % csillapítás            %
 
x =-10:0.05:10;            % Lehet módosítani, de felesleges
y =-4:0.05:4;              % Lehet módosítani, de felesleges
[X,Y] = meshgrid(x,y); %hálót készít x,y vektorok alapján (az energiák kiszámításához az adott pontokban)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          Feladatok          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         1. egyenlet         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

egyenlet_1=;

energia_rugo=;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         2.egyenlet          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

egyenlet_2=; 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         3.egyenlet          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

egyenlet_3=; 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         4.egyenlet          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

w=;                                         % Paraméter, tetszõleges

egyenlet_4=; 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         5.egyenlet          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

egyenlet_5=; 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         6-10.egyenlet          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


egyenlet_6=;                                                    

egyenlet_7=;                                                    
energia_inga=;

egyenlet_8=;                                                    


egyenlet_9=; 

Z = ; % Energia


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%             ODE45              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[t, xy]=ode45(); %diffegyenletet kiszámol


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         Kirajzoltatás          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      x-y szerint, energia      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure;
subplot(2,2,1);                         %ábrák elhelyezése egy mezõn belül, számolás balról jobbra, fentrõl le
hold on;
energiaszintek=[0, 0.1 0.25, 0.5, 1, 1.4, 2, 2.4, 3, 4];    %ezeken a szinteken számolom ki az energiát
contour(X,Y,Z, energiaszintek);         %energia szintvonalak ábrázolása
plot(xy(:,1), xy(:,2), 'b');            
xlabel('x');
ylabel('y');
hold off;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%           x-t szerint          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
subplot(2,2,3);
plot(xy(:,1), t, 'b');
xlabel('x');
ylabel('t');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%           t-y szerint          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot(2,2,2);
plot(t, xy(:,2), 'b');
xlabel('t');
ylabel('y');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%       x-y-t 3D-s ábrázolás     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot(2,2,4);
plot3(xy(:,1), xy(:,2), t, 'b');
xlabel('x');
ylabel('y');
zlabel('t');
