Professional Documents
Culture Documents
%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...