#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <complex>
using namespace std;
void InvLapTrans(complex<double> (*vs)(complex<double> s),double tstart,
double tend,double tdelta)
{
double t,vt;
int count;
static const complex<double> z[5] = {
complex<double>(11.83009373916819,1.593753005885813),
complex<double>(11.22085377939519,4.792964167565670),
complex<double>(9.933383722175002,8.033106334266296),
complex<double>(7.781146264464616,11.36889164904993),
complex<double>(4.234522494797000,14.95704378128156)};
static const complex<double> Kp[5] = {
complex<double>(16286.62368050479,-139074.7115516051),
complex<double>(-28178.11171305163,74357.58237274176),
complex<double>(14629.74025233142,-19181.80818501836),
complex<double>(-2870.418161032078,1674.109484084304),
complex<double>(132.1659412474876,17.47674798877164)};
t = tstart;
count = 0;
while (t <= tend) {
vt = 0.0;
for (int i=0;i<5;i++) {
vt = vt — real(vs(z[i] / t) * Kp[i]);
}
vt /= t;
cout<<count<<" "<<vt<<endl;
count++;
t += tdelta;
}
}
complex<double> vs(complex<double> s)
{
return 1.0/(s+1.0);
}
int main(int argc, char* argv[])
{
double tstart = 0.01;
double tend = 3.2;
double tdelta = 0.05;
InvLapTrans(vs,tstart,tend,tdelta);
return 0;
}