Matlab Coefficient Generator

(save text as coeff.m)



format short e coeff=[ -5.0 CM5P0(5) CM5P0(4) CM5P0(3) CM5P0(2) CM5P0(1) -4.5 CM4P5(5) CM4P5(4) CM4P5(3) CM4P5(2) CM4P5(1) -4.0 CM4P0(5) CM4P0(4) CM4P0(3) CM4P0(2) CM4P0(1) -3.5 CM3P5(5) CM3P5(4) CM3P5(3) CM3P5(2) CM3P5(1) -3.0 CM3P0(5) CM3P0(4) CM3P0(3) CM3P0(2) CM3P0(1) -2.5 CM2P5(5) CM2P5(4) CM2P5(3) CM2P5(2) CM2P5(1) -2.0 CM2P0(5) CM2P0(4) CM2P0(3) CM2P0(2) CM2P0(1) -1.5 CM1P5(5) CM1P5(4) CM1P5(3) CM1P5(2) CM1P5(1) -1.0 CM1P0(5) CM1P0(4) CM1P0(3) CM1P0(2) CM1P0(1) -0.5 CM0P5(5) CM0P5(4) CM0P5(3) CM0P5(2) CM0P5(1) +0.0 CP0P0(5) CP0P0(4) CP0P0(3) CP0P0(2) CP0P0(1) +0.5 CP0P5(5) CP0P5(4) CP0P5(3) CP0P5(2) CP0P5(1) +1.0 CP1P0(5) CP1P0(4) CP1P0(3) CP1P0(2) CP1P0(1) ]; K0=polyfit(coeff(:,1),coeff(:,2),7) K1=polyfit(coeff(:,1),coeff(:,3),7) K2=polyfit(coeff(:,1),coeff(:,4),7) K3=polyfit(coeff(:,1),coeff(:,5),7) K4=polyfit(coeff(:,1),coeff(:,6),7) vg=-5.0:0.1:1.0; fitK0=polyval(K0,vg); fitK1=polyval(K1,vg); fitK2=polyval(K2,vg); fitK3=polyval(K3,vg); fitK4=polyval(K4,vg); plot(vg,fitK0,coeff(:,1),coeff(:,2)) grid title('RCA 12ax7 Lateral Coefficient K0(Vg)') xlabel('grid voltage (Volts)') pause plot(vg,fitK1,coeff(:,1),coeff(:,3)) grid title('RCA 12ax7 Lateral Coefficient K1(Vg)') xlabel('grid voltage (Volts)') pause plot(vg,fitK2,coeff(:,1),coeff(:,4)) grid title('RCA 12ax7 Lateral Coefficient K2(Vg)') xlabel('grid voltage (Volts)') pause plot(vg,fitK3,coeff(:,1),coeff(:,5)) grid title('RCA 12ax7 Lateral Coefficient K3(Vg)') xlabel('grid voltage (Volts)') pause plot(vg,fitK4,coeff(:,1),coeff(:,6)) grid title('RCA 12ax7 Lateral Coefficient K4(Vg)') xlabel('grid voltage (Volts)') pause

~:( HOME :)~

viva Analog /// jc -> lynx.net