You are on page 1of 5

function InverseScatteringExample

%This is an example of solving the inverse scattering problem for time


%domain reflectometer. This supports the paper "Development of Wire
%Dianostics System: Algorithms Development to Ascertain the True
%Characteristics Impedance of a Wire. The example uses a coaxial cable with
%75 to 50 to 75 to 50 to 75 to Open, which generates a number of
%reflections
%This data was taken with a .256 volt TDR with a rise time of 10 ps
%config
vmeas = GetCoaxData();
n = length(vmeas);
dt = 200e-12;
vop = 1/sqrt(2.1);
c = 299792458;
m2ft = 3.280830;
vinc = .256;
Zo
= 50;

%sample rate
%velocity of propagation
%speed of light
%vincident
%refernce impedance

zmeas = V2Z(vmeas,vinc,Zo);
Zref = glad_in(vmeas, vinc, Zo);
vref = Z2V(Zref,vinc, Zo);
len = (1:n)*c*vop*dt/2*m2ft;
subplot(2,1,1)
plot(len,vmeas,len, vref)
legend('V Measured', 'V Actual',4)
axis([0 len(end) .25 .55])
xlabel('Distance (Ft)')
ylabel('Volts')
title('Voltate vs. Distance')
subplot(2,1,2)
plot(len,zmeas,len,Zref)
legend('Z Measured', 'Z Actual',4)
axis([0 len(end) 40 100])
xlabel('Distance (Ft)')
ylabel('Impedance')
title('Impedance vs. Distance')
%---------------------------------------------------------------------function Z = glad_in(vmes, vin, Zo)
%Z = glad_in(vmes, vin, Zo)
%Performs the compact gladwell inverse scattering algoirthm for Z
%inputs:
% vmeas :
measured voltage waveform
% vin
:
the incident voltage, which is 1/2 the total drive voltage
% Zo
:
the characteristic impedance of the test harness (typically 50
% ohms.
%output:
% Z
:
Corrected charachteristic impedance
Z(1) = Zo;
xet=sqrt(Zo);

N = length(vmes);
D = zeros(2,N);
U = zeros(2,N);
% D(1,1:N)= vin(60+(1:N))./xet;
% U(1,1:N)= (vin(60+(1:N))-vmes)./xet;
D(1,1:N)= vin/xet;
U(1,1:N)= (vin-vmes)./xet;
for i = 2:N,
im = i-1;
ip = i+1;
r = U(1,i)/D(1,im);
%Reflection Coefficient
R(i) = r;
ratio(i) = (1-r)/(1+r);
Z(i) = Z(im)*(1-r)/(1+r);
s = 2*Z(im)/(Z(im)+Z(i));
si(i) = s;
D(2,i)=s*D(1,im);
sp=s*Z(i)/Z(im);
spi(i) = sp;
for j = ip:(N),
jm = j-1;
jp = j;
U(2,j)=(-r*D(1,jm)+U(1,jp))/sp;
D(2,j) =s*D(1,jm) - r*U(2,j);
end
U(1,:)=U(2,:);
D(1,:)=D(2,:);
end
%---------------------------------------------------------------------function Vmeas = Z2V(Z,Vin,z0);
%Vmeas = Z2V(Z,Vin,z0);
if nargin < 3,
z0 = 50;
end
Vmeas = Z.*2.*Vin./(z0+Z);
%---------------------------------------------------------------------function Z = V2Z(Vmeas,Vin,zo);
%Z = V2Z(Vmeas,Vin,zo);
if nargin < 3,
zo = 50;
end
den = 2*Vin-Vmeas;
idx = find(den <=0);
den(idx) = .0001;
Z = zo*Vmeas./den;
%----------------------------------------------------------------------

function a = GetCoaxData()
a=[0.257498 0.259175 0.260484 0.269296 0.260361 0.2604 0.26065 0.260312...
0.260538 0.260277 0.260298 0.259858 0.259717 0.259824 0.259805 0.259622...
0.259503 0.25949 0.261519 0.259468 0.259204 0.259043 0.259138 0.25911...
0.25903 0.258777 0.258903 0.258813 0.258789 0.258565 0.258536 0.258712...
0.258717 0.258442 0.258699 0.258568 0.258433 0.258667 0.25844 0.258609...
0.258501 0.25863 0.258559 0.258554 0.258658 0.258483 0.258597 0.258604...
0.258577 0.258573 0.258618 0.258601 0.258462 0.258745 0.258649 0.258599...
0.258759 0.258548 0.258601 0.258706 0.258544 0.258644 0.258614 0.258762...
0.258715 0.25873 0.258808 0.258828 0.258906 0.258825 0.259063 0.259061...
0.258899 0.259091 0.259142 0.259252 0.259221 0.259283 0.259296 0.259164...
0.259111 0.259239 0.259268 0.259522 0.259067 0.259073 0.258992 0.258919...
0.267686 0.26246 0.2665 0.278957 0.332308 0.318315 0.297042 0.296805...
0.308061 0.305543 0.303123 0.305701 0.305373 0.303142 0.305198 0.306783...
0.304753 0.305911 0.307304 0.306422 0.30552 0.306516 0.30585 0.305787...
0.306202 0.305185 0.305456 0.30569 0.305832 0.305191 0.306125 0.306742...
0.325443 0.309975 0.269111 0.270391 0.270967 0.262246 0.260397 0.260503...
0.258885 0.259781 0.258987 0.258654 0.259694 0.258977 0.258599 0.25864...
0.258526 0.258598 0.259307 0.258895 0.25886 0.258701 0.258587 0.258252...
0.258459 0.258386 0.25846 0.258796 0.258064 0.256053 0.259979 0.262515...
0.271827 0.301685 0.285707 0.269899 0.271403 0.288942 0.29708 0.303263...
0.30478 0.30186 0.30288 0.302572 0.301791 0.301306 0.301912 0.301822...
0.301498 0.301414 0.301852 0.302095 0.301612 0.301532 0.30149 0.301749...
0.301997 0.302396 0.30198 0.302205 0.303312 0.301405 0.298976 0.306905...
0.311704 0.316516 0.309851 0.297865 0.288895 0.283145 0.271519 0.269034...
0.267853 0.266351 0.266257 0.265707 0.265033 0.265237 0.264792 0.264701...
0.265395 0.265191 0.265049 0.264617 0.264527 0.264561 0.264702 0.264633...
0.264673 0.263099 0.264447 0.264449 0.263432 0.264444 0.261026 0.265403...
0.269636 0.266637 0.258133 0.256926 0.261395 0.261858 0.258294 0.258258...
0.256455 0.255246 0.255003 0.254589 0.25434 0.255192 0.255035 0.254806...
0.254854 0.254799 0.254978 0.255265 0.254811 0.254418 0.25397 0.254532...
0.255245 0.25538 0.254506 0.254977 0.253881 0.254505 0.253806 0.255012...
0.25523 0.254644 0.253153 0.25489 0.255856 0.254686 0.254879 0.256835...
0.257552 0.257426 0.257835 0.257647 0.257096 0.25743 0.257381 0.257678...
0.258049 0.258016 0.257777 0.257841 0.257635 0.257954 0.257698 0.25754...
0.258057 0.258358 0.258136 0.258075 0.257822 0.257813 0.259107 0.265729...
0.274452 0.284072 0.313127 0.3663 0.414495 0.447569 0.461033 0.457784...
0.451886 0.44822 0.449138 0.451853 0.454407 0.456612 0.457378 0.457993...
0.458625 0.459261 0.460006 0.461179 0.461559 0.461817 0.461772 0.462088...
0.462809 0.463154 0.462779 0.462575 0.462207 0.463449 0.466774 0.466392...
0.464471 0.471485 0.486457 0.495785 0.493359 0.490985 0.4942 0.499931...
0.507888 0.512112 0.512565 0.511757 0.510606 0.510354 0.510803 0.511426...
0.51212 0.512555 0.512562 0.512716 0.51264 0.51291 0.513436 0.51386...
0.513836 0.513964 0.514572 0.515021 0.515672 0.515344 0.514322 0.512097...
0.510267 0.511611 0.512117 0.510028 0.506338 0.502844 0.499318 0.494565...
0.492051 0.491805 0.492237 0.494205 0.49513 0.495248 0.49553 0.495067...
0.494879 0.494649 0.494527 0.49472 0.49494 0.494724 0.494312 0.494173...
0.494436 0.49495 0.495654 0.495766 0.496619 0.497719 0.497983 0.501545...
0.507055 0.512179 0.52058 0.529577 0.536521 0.542177 0.542684 0.539183...
0.536855 0.535399 0.535198 0.536682 0.53771 0.538073 0.538275 0.537899...
0.537952 0.538376 0.538664 0.538965 0.539311 0.539198 0.53931 0.539428...
0.539634 0.539522 0.539908 0.540298 0.540523 0.54017 0.539267 0.537535...
0.534814 0.532035 0.53068 0.529507 0.530446 0.530782 0.528651 0.524856...
0.521919 0.520001 0.519148 0.520202 0.520811 0.52096 0.521024 0.520602...
0.520222 0.520365 0.520409 0.520345 0.520469 0.520455 0.520532 0.520548...
0.520324 0.520064 0.51993 0.519971 0.519888 0.52 0.520546 0.520316...
0.519846 0.521515 0.525873 0.531477 0.537472 0.541495 0.543546 0.544159...

0.543574 0.541912 0.53963 0.538303 0.537692 0.538349 0.539493 0.540249...


0.540774 0.540983 0.540631 0.540867 0.540941 0.540565 0.540967 0.541066...
0.540719 0.540673 0.540581 0.541186 0.542582 0.543893 0.543189 0.54359...
0.544444 0.544207 0.542735 0.540456 0.537717 0.535101 0.532365 0.530924...
0.531399 0.533335 0.535866 0.537397 0.537353 0.536189 0.534914 0.534097...
0.534082 0.534396 0.534569 0.53486 0.534947 0.5347 0.534639 0.534614...
0.534595 0.534544 0.534423 0.534809 0.534638 0.533161 0.530736 0.5294...
0.527557 0.524532 0.52103 0.519134 0.518164 0.516852 0.514637 0.510933...
0.507593 0.505241 0.504946 0.506079 0.507618 0.508567 0.5084 0.507921...
0.507218 0.506671 0.506379 0.506331 0.506433 0.506333 0.506217 0.5059...
0.505617 0.505376 0.5055 0.506077 0.50615 0.506355 0.508043 0.50996...
0.510783 0.511961 0.514469 0.517907 0.52128 0.523933 0.525347 0.525377...
0.524735 0.523744 0.522874 0.522657 0.523011 0.523668 0.52409 0.524366...
0.5242 0.524207 0.52404 0.524115 0.524194 0.524282 0.524624 0.524771...
0.524801 0.525131 0.525304 0.525475 0.525423 0.525218 0.524359 0.523393...
0.521584 0.518975 0.516642 0.514374 0.512701 0.511751 0.510968 0.510742...
0.51068 0.510827 0.510806 0.510625 0.510433 0.510026 0.509746 0.509716...
0.509785 0.509902 0.509804 0.509471 0.509529 0.509269 0.509478 0.509438...
0.509334 0.509265 0.508791 0.508317 0.508094 0.507785 0.507271 0.507129...
0.506934 0.506589 0.506512 0.506767 0.507136 0.50779 0.508306 0.507784...
0.507202 0.506868 0.506979 0.507373 0.50758 0.507464 0.506841 0.506665...
0.506712 0.506931 0.507305 0.507415 0.507433 0.507154 0.506937 0.506918...
0.507011 0.507084 0.507145 0.507659 0.507991 0.508719 0.509279 0.510319...
0.510899 0.511318 0.511377 0.511443 0.511349 0.511556 0.511527 0.511017...
0.510938 0.510931 0.51156 0.512537 0.513712 0.514247 0.514052 0.513403...
0.512873 0.512364 0.51248 0.512979 0.513243 0.513436 0.51357 0.513546...
0.513552 0.513294 0.513195 0.513206 0.512603 0.512026 0.510767 0.50979...
0.508732 0.507003 0.505684 0.504712 0.504212 0.504269 0.50415 0.503672...
0.503015 0.502092 0.50117 0.500997 0.501261 0.501644 0.502134 0.502492...
0.502299 0.502123 0.501576 0.501334 0.50117 0.501193 0.501232 0.501154...
0.500838 0.500822 0.500649 0.500346 0.500589 0.501179 0.501484 0.502022...
0.503068 0.504147 0.505112 0.506146 0.506998 0.508185 0.509276 0.509912...
0.510263 0.510542 0.51045 0.510342 0.510273 0.510024 0.509915 0.509868...
0.510031 0.510334 0.510575 0.5108 0.510496 0.510473 0.510496 0.510484...
0.510914 0.510893 0.510988 0.511312 0.511471 0.511419 0.511354 0.511202...
0.510947 0.51044 0.509825 0.508954 0.50822 0.507724 0.507688 0.507702...
0.507748 0.50779 0.508078 0.508518 0.508764 0.508709 0.508514 0.508061...
0.507687 0.507662 0.507691 0.507935 0.507868 0.508041 0.507727 0.507606...
0.507556 0.507508 0.507195 0.507016 0.506862 0.506311 0.505941 0.505878...
0.505757 0.505709 0.505728 0.505741 0.505759 0.505791 0.505937 0.505878...
0.505434 0.505099 0.504852 0.504796 0.504862 0.505207 0.505326 0.505272...
0.505009 0.504563 0.504428 0.504529 0.504775 0.50483 0.504907 0.504893...
0.504642 0.504759 0.504976 0.50524 0.505606 0.506277 0.506627 0.507187...
0.507619 0.508355 0.508825 0.50907 0.509487 0.509878 0.510157 0.5104...
0.510474 0.510508 0.510544 0.510464 0.510497 0.510803 0.510887 0.511138...
0.5111 0.511075 0.511053 0.511018 0.510976 0.511411 0.511609 0.511719...
0.511917 0.511776 0.511714 0.511501 0.511388 0.511006 0.510694 0.510122...
0.509589 0.508956 0.508445 0.507888 0.507301 0.507073 0.506916 0.507064...
0.50707 0.506718 0.50641 0.506329 0.506151 0.506158 0.506251 0.506149...
0.506357 0.506486 0.506613 0.506424 0.506364 0.506007 0.505709 0.505817...
0.505793 0.505675 0.505651 0.505738 0.505697 0.505799 0.505781 0.506034...
0.506561 0.506805 0.507074 0.507497 0.507672 0.507785 0.508197 0.508602...
0.508652 0.508708 0.508708 0.508735 0.508832 0.508818 0.508924 0.508607...
0.508396 0.508502 0.508698 0.508763 0.508896 0.509113 0.508957 0.508941...
0.509012 0.509116 0.509319 0.509522 0.509729 0.509956 0.509895 0.509878...
0.50979 0.509646 0.509563 0.509585 0.509307 0.509295 0.509328 0.509185...
0.509488 0.509595 0.509586 0.509607];

You might also like