function input1d
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT DATA
%       name        Application name
%       n           degree (1 for linear, 2 for quadratic, 3 for cubic etc)
%       h           grid width
%       NP          number of points for integration 
%
%             -d/dx (px du/dx)+qx u=fx
% 
% Boundary Conditions (BC) 
% u=bound.u                     at x=xi or x=xe Dirichlet BC
% du/dx+bound.BNq*u=bound.BNg   at x=xi or x=xe Cauchy BC
% 
%       bound.BC    0 for DRICHLET, 1 for NEUMANN
%       bound.x     position
%       bound.BNq   for NEUMANN
%       bound.BNg   for NEUMANN
%       bound.u     for DRICHLET
%
%       u_exact     exact solution
%       du_exact    derivative od exact solution
%       weight      weight function
%       weightt     derivative of weight function
%
% Created by G.Apaydin  in June 2006
% Modified              in Sep 2006
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global name n NP h px qx fx bound u_exact du_exact weight weightt xi xe
name='Exp5';cwd=pwd;cd('input');
fid=fopen([name,'.txt']);in=textscan(fid,'%s');
n=str2num(cell2mat(in{1}(1)));
h=str2num(cell2mat(in{1}(2)));
NP=str2num(cell2mat(in{1}(3)));
%-------------------------FUNCTIONS OF PDE---------------------------------
px=inline(cell2mat(in{1}(4)),'x');
qx=inline(cell2mat(in{1}(5)),'x');
fx=inline(cell2mat(in{1}(6)),'x');
bound.x{2}=str2num(cell2mat(in{1}(7)));
bound.BC{2}=str2num(cell2mat(in{1}(8)));
%-----------------------END POINT CONDITIONS-------------------------------
if bound.BC{2},
    bound.BNq{2}=str2num(cell2mat(in{1}(9)));
    bound.BNg{2}=str2num(cell2mat(in{1}(10)));
else bound.u{2}=str2num(cell2mat(in{1}(11)));end
%-----------------------INITIAL POINT CONDITIONS---------------------------
bound.x{1}=str2num(cell2mat(in{1}(12)));
bound.BC{1}=str2num(cell2mat(in{1}(13)));
xi=bound.x{1};xe=bound.x{2};
if bound.BC{1},
    bound.BNq{1}=str2num(cell2mat(in{1}(14)));
    bound.BNg{1}=str2num(cell2mat(in{1}(15)));
else bound.u{1}=str2num(cell2mat(in{1}(16)));end
%--------------------------EXACT SOLUTION----------------------------------
u_exact=inline(cell2mat(in{1}(17)),'x');
du_exact=inline(cell2mat(in{1}(18)),'x');
%--------------------------WEIGHT FUNCTION---------------------------------
if (bound.BC{1}+bound.BC{2})==0
    weight=@(x) (xe-x).*(x-xi);weightt=@(x) -2*x+xe+xi;
elseif (bound.BC{1}+bound.BC{2})==2
    weight=@(x) (x<=xe).*(x>=xi);weightt=@(x) 0;
elseif bound.BC{2}==1
    weight=@(x) (x<=xe).*(x-xi);weightt=@(x) (x<=xe);
else weight=@(x) (x>=xi).*(xe-x);weightt=@(x) -(x>=xi);
end
fclose(fid);cd(cwd);