%Math 316 - Spring 2017
%Written by M. Motamed @ UNM 
%==================================================
%EXAMPLE 4 of Chapter 2. ODE: y'+(t/2)*y=1 & y(0)=1
%==================================================

T=10;
t=linspace(0,T,100);

F = @(s) exp((s.^2)/4);

Q=zeros(size(t));

for i=1:length(t)
    Q(i)=quad(F,0,t(i));
end

y = exp(-(t.^2)/4).*(Q+1);

figure
plot(t,y,'Linewidth',1.5)
xlabel('t')
ylabel('y(t)')
set(gca,'fontsize', 20); 
    
