function [Sae Sde]=EC8spec(T,ag,S,Tb,Tc,Td,ceta)

% izracuna elasticni spekter po EC8
% [Sae Sde]=EC8spec(T,ag,S,Tb,Tc,Td,ceta)
%  Sae -spektralni pospe�ek v g
%  Sde -spektralni pomik v m
%  ceta v %
% EC8 - tip spektra 1
%   Tip tal	S	    TB (s)	TC (s)	TD (s)
%   A      	1,0	    0,15	0,4	    2,0
%   B	    1,2	    0,15	0,5	    2,0
%   C      	1,15	0,20	0,6	    2,0
%   D      	1,35	0,20	0,8	    2,0
%   E      	1,4	    0,15	0,5 	2,0
% EC8 - nacionalni dodatek
%   Tip tal	S	    TB (s)	TC (s)	TD (s)
%   A      	1,0	    0,10	0,4	    2,0
%   B	    1,2	    0,15	0,5	    2,0
%   C      	1,15	0,20	0,6	    2,0
%   D      	1,35	0,20	0,8	    2,0
%   E      	1,7	    0,10	0,4 	2,0
%
%
% Referenced manuscripts:
%
% Dolsek M. (2010). Development of computing environment for the seismic
% performance assessment of reinforced concrete frames by using simplified
% nonlinear models. Bulletin of Earthquake Engineering (Published online
% 16 May 2010), DOI: 10.1007/s10518-010-9184-8. 
%
% Contact: mdolsek@ikpir.fgg.uni-lj.si
%
% Copyright (C) 2010 Matjaz Dolsek
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation, version 2.
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.



eta=max([sqrt(10/(5+ceta)) 0.55]);
Sae = zeros(max(size(T)),1);
for t=1:max(size(T))
    if T(t)>=0 & T(t)<= Tb
        Sae(t)=ag*S*(1+T(t)/Tb*(eta*2.5-1));
    elseif T(t)>Tb & T(t)<= Tc
        Sae(t)=ag*S*eta*2.5;
    elseif T(t)>Tc & T(t)<= Td
        Sae(t)=ag*S*eta*2.5*Tc/T(t);
    elseif T(t)>Td & T(t)<=4
        Sae(t)=ag*S*eta*2.5*(Tc*Td)/T(t)^2;
    else
        Sae(t)=0;
    end
end
    
Sde=T.^2.*Sae./(4*pi^2).*9.81;
