#
#octave_smith_admitance.m
#https://octave-online.blogspot.jp/search/label/smith_admitance
#
function sys = octave_smith_admitance( a1, b1, c1, d1 )

	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;

	yl = a2 + b2 * sqrt(-1);
	gamma0 = ( 1 - yl ) / ( 1 + yl )

	ya = c2 + d2 * sqrt(-1);
	y = yl + ya;
	gamma1 = ( 1 - y ) / ( 1 + y )

	YYR = linspace( a2, a2+c2, 10);
	YYI = linspace( b2, b2+d2, 10);

	for i=1:1:10 
	 YY(i) = YYR(i) + b2 * sqrt(-1);
	end
	for i=11:1:20
	 YY(i) = YYR(10) + YYI( i - 10 ) * sqrt(-1);
	end

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

	for i=1:1:20 
	 GG(i) = ( 1 - YY(i) ) / ( 1 + YY(i) ); 
	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
