#
#octave_smith.m
#https://ix86.org/octave/index-main.html?octave_smith
#
function sys = octave_smith( a1, b1, c1, d1 )

#	a2 = sscanf(a1,"%f");
#	b2 = sscanf(b1,"%f");
#	c2 = sscanf(c1,"%f");
#	d2 = sscanf(d1,"%f");

	printf("Z_L / Z_0 = %f + %f j\n", a1, b1);
	printf("Z_a / Z_0 = %f + %f j\n", c1, d1);

	a2 = a1;
	b2 = b1;
	c2 = c1;
	d2 = d1;
	
	zl = a2 + b2 * sqrt(-1);
	gamma0 = ( zl - 1 ) / ( zl + 1 )

	za = c2 + d2 * sqrt(-1);
	z = zl + za;
	gamma1 = ( z - 1 ) / ( z + 1 )

	#ZZ = linspace( zl, z, 10);
	ZZR = linspace( a2, a2+c2, 10);
	ZZI = linspace( b2, b2+d2, 10);

	for i=1:1:10 
	 ZZ(i) = ZZR(i) + b2 * sqrt(-1);
	end
	for i=11:1:20
	 ZZ(i) = ZZR(10) + ZZI( i - 10 ) * sqrt(-1);
	end

	#for i=1:1:20
	# ZZ(i)
	#end

	for i=1:1:20 
	 GG(i) = ( ZZ(i) - 1 ) / ( ZZ(i) + 1 ); 
	end

	for i=1:1:20 
	 GGR(i)=real( GG( i ) );
	 GGI(i)=imag( GG( i ) );
	end

	#gset size  square;
	#gset xrange [-1:1];
	#gset yrange [-1:1];
	plot( GGR, GGI );
	axis ([-1, 1, -1, 1], "square");
	
	sys="";

endfunction
