%% sunspn.m calulates the current sunspot number from the F10.7A
%% using the inverse of the equation from the IRI95 TCON.FOR
%% program.

function ssn=sunspn(timmat,dno,year)

% timmat = UT time
% dno = day number
% year = year
% ssn = sunspot number

[kp,kpmin,apday,f107,f107a]=solarval(timmat,dno,year);

a=0.00089;
b=0.728;
c=(63.75-f107);
ssn=(-b+sqrt(b^2-4*a*c))/(2*a);
