%
%   INVLPTDEMO.M   Demo of how to take Inverse Laplace Transforms with Matlab
%
%   This file illustrates some simple uses of the Inverse Laplace Transform 
%   capability within the Symbolic Toolbox in Matlab.
%   
%   In particular, given a short list of common s-domain functions, F(s), we 
%   generate their associated inverse Laplace transforms.  
%
%   In the following examples,
%      t - time domain independent variable
%      s - Laplace domain independent variable
%    a,b,c - constants
%
%   File written by J. R. White, UMass-Lowell (Feb. 1998)
%

%
%   getting started
      clear all,   close all
      syms a b c t s
%
%   let's define a set of s-domain functions (these are symbolic variables)
      F1 = c/s;                   F2 = c/s^2;   
      F3 = 1/(s+a);               F4 = 1/(s+a)^2;
      F5 = c/s - 1/(s+a);         F6 = c/(s+a) - a/(s+a)^2;
      F7 = 1/(s+a) - 1/(s+b);     F8 = -a/(s+a) + b/(s+b);
      F9 = b/(s^2+b^2);           F10 = s/(s^2+b^2);
      F11 = b/(s^2-b^2);          F12 = s/(s^2-b^2);
      F13 = (s+a)/((s+a)^2+b^2);  F14 = b/((s+a)^2+b^2);
%
%   now let's find the inverse Laplace transforms for these functions
      f1 = ilaplace(F1,s,t);     f1 = simple(f1);
      f2 = ilaplace(F2,s,t);     f2 = simple(f2);
      f3 = ilaplace(F3,s,t);     f3 = simple(f3);
      f4 = ilaplace(F4,s,t);     f4 = simple(f4);
      f5 = ilaplace(F5,s,t);     f5 = simple(f5);
      f6 = ilaplace(F6,s,t);     f6 = simple(f6);
      f7 = ilaplace(F7,s,t);     f7 = simple(f7);
      f8 = ilaplace(F8,s,t);     f8 = simple(f8);
      f9 = ilaplace(F9,s,t);     f9 = simple(f9);
      f10 = ilaplace(F10,s,t);   f10 = simple(f10);
      f11 = ilaplace(F11,s,t);   f11 = simple(f11);
      f12 = ilaplace(F12,s,t);   f12 = simple(f12);
      f13 = ilaplace(F13,s,t);   f13 = simple(f13);
      f14 = ilaplace(F14,s,t);   f14 = simple(f14);
%
%   now let's create a short table of inverse Laplace transform pairs
      fprintf(1,'            Table of Commom Inverse Laplace Transforms  \n\n')
      fprintf(1,'        F(s) \t\t\t             f(t) \n')
      fprintf(1,'   F1 = %s   \t\t\t       f1 = %s  \n',char(F1),char(f1))
      fprintf(1,'   F2 = %s   \t\t       f2 = %s  \n',char(F2),char(f2))
      fprintf(1,'   F3 = %s   \t\t       f3 = %s  \n',char(F3),char(f3))
      fprintf(1,'   F4 = %s   \t\t       f4 = %s  \n',char(F4),char(f4))
      fprintf(1,'   F5 = %s   \t\t       f5 = %s  \n',char(F5),char(f5))
      fprintf(1,'   F6 = %s   \t       f6 = %s  \n',char(F6),char(f6))
      fprintf(1,'   F7 = %s   \t       f7 = %s  \n',char(F7),char(f7))
      fprintf(1,'   F8 = %s               f8 = %s  \n',char(F8),char(f8))
      fprintf(1,'   F9 = %s   \t\t       f9 = %s  \n',char(F9),char(f9))
      fprintf(1,'   F10 = %s  \t\t       f10 = %s  \n',char(F10),char(f10))
      fprintf(1,'   F11 = %s  \t\t       f11 = %s  \n',char(F11),char(f11))
      fprintf(1,'   F12 = %s  \t\t       f12 = %s  \n',char(F12),char(f12))
      fprintf(1,'   F13 = %s           f13 = %s  \n',char(F13),char(f13))
      fprintf(1,'   F14 = %s               f14 = %s  \n',char(F14),char(f14))
%
%   To evaluate these functions for specific values, we simply substitute
%   specific constants for the symbolic variables (a, b, and c).
%
%   For example, if a = 2 and b = 3, F14 and f14 become:
      F14s = subs(F14,{a,b},{2,3});  f14s = subs(f14,{a,b},{2,3});
      fprintf(1,'\n')
      fprintf(1,'   For a = 2 and b = 3, the last entry becomes: \n')
      fprintf(1,'   F14s = %s  \t       f14s = %s  \n',char(F14s),char(f14s))
%
%   end of program
%