classdef forceddampedduffing2d
    
    properties
        alpha;
        beta;
    end
    
    methods
        % constructor
        function obj = forceddampedduffing2d(Alpha, Beta)
            if nargin > 0
                obj.alpha = Alpha;
            else
                obj.alpha = -0.25;
            end
                
            if nargin > 1
                obj.beta = Beta;
            else
                obj.beta = 0.4;
            end
        end
        
        % Samples the phase space vector field of the forced damped duffing oscillator
        function [u, v] = sample(obj, x, y, t)
            u = y;
			v = obj.alpha * y - x * x*x + x + obj.beta * cos(t);
        end
        
        % Samples the phase space x-partial of the vector field of the forced damped duffing oscillator
        function [u, v] = sample_dx(obj, x, y, t)
            u = 0;
			v = 1 - 3 * x*x;
        end
        
        % Samples the phase space y-partial of the vector field of the forced damped duffing oscillator
        function [u, v] = sample_dy(obj, x, y, t)
            u = 1;
			v = obj.alpha;
        end
        
        % Samples the phase space t-partial of the vector field of the forced damped duffing oscillator
        function [u, v] = sample_dt(obj, x, y, t)
            u = 0;
			v = -obj.beta * sin(t);
        end
    end
    
end

