clc;
Vd = xlsread('W1umL3um.xlsx', 'C4:C43');
Id0 = xlsread('W1umL3um.xlsx', 'D56:D95');
Id2 = xlsread('W1umL3um.xlsx', 'F56:F95');
Id4 = xlsread('W1umL3um.xlsx', 'H56:H95');
Id6 = xlsread('W1umL3um.xlsx', 'J56:J95');
Id8 = xlsread('W1umL3um.xlsx', 'L56:L95');
Id10 = xlsread('W1umL3um.xlsx', 'N56:N95');
Id12 = xlsread('W1umL3um.xlsx', 'P56:P95');
[xData, yData] = prepareCurveData( Vd, Id0 );
ft = fittype( '(a1.*0.00575.*((0-b1).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off'
opts.StartPoint = [0.196595250431208 0.251083857976031];
[fitresult, gof] = fit( xData, yData, ft, opts )
figure( 'Name', 'Vg = 0V' );
h1 = plot( fitresult, xData, yData, 'ok')
h1(1).LineWidth = 1;
h1(2).LineWidth = 2;
hold on
[xData, yData] = prepareCurveData( Vd, Id2 );
ft = fittype( '(a2.*0.00575.*((0.2-b2).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.162182308193243 0.794284540683907];
[fitresult, gof] = fit( xData, yData, ft, opts )
h2 = plot( fitresult, xData, yData, 'ok')
h2(1).LineWidth = 1;
h2(2).LineWidth = 2;
grid on
[xData, yData] = prepareCurveData( Vd, Id4 );
ft = fittype( '(a3.*0.00575.*((0.4-b3).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.311215042044805 0.528533135506213];
[fitresult, gof] = fit( xData, yData, ft, opts )
h3 = plot( fitresult, xData, yData, 'ok')
h3(1).LineWidth = 1;
h3(2).LineWidth = 2;
[xData, yData] = prepareCurveData( Vd, Id6 );
ft = fittype( '(a4.*0.00575.*((0.6-b4).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.165648729499781 0.601981941401637];
[fitresult, gof] = fit( xData, yData, ft, opts )
h4 = plot( fitresult, xData, yData, 'ok')
h4(1).LineWidth = 1;
h4(2).LineWidth = 2;
[xData, yData] = prepareCurveData( Vd, Id8 );
ft = fittype( '(a5.*0.00575.*((0.8-b5).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.262971284540144 0.654079098476782];
[fitresult, gof] = fit( xData, yData, ft, opts )
h5 = plot( fitresult, xData, yData, 'ok')
h5(1).LineWidth = 1;
h5(2).LineWidth = 2;
[xData, yData] = prepareCurveData( Vd, Id10 );
ft = fittype( '(a6.*0.00575.*((1.0-b6).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.689214503140008 0.748151592823709];
[fitresult, gof] = fit( xData, yData, ft, opts )
h6 = plot( fitresult, xData, yData, 'ok')
h6(1).LineWidth = 1;
h6(2).LineWidth = 3;
[xData, yData] = prepareCurveData( Vd, Id12 );
ft = fittype( '(a7.*0.00575.*((1.2-b7).*Vd - (Vd.^2/2)))*1000', 'independent', 'Vd', 'dependent', 'Id12' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.380445846975357 0.567821640725221];
[fitresult, gof] = fit( xData, yData, ft, opts )
h7 = plot( fitresult, xData, yData, 'ok')
h7(1).LineWidth = 1;
h7(2).LineWidth = 2;
grid on
xlabel ('Drain Voltage (V)')
ylabel ('Drain Current (mA/um)')
title ('Drain Current vs Drain Voltage w/ varying Gate Voltage')
hold off
Best Answer