Data plotting in Excel sheet from the Arduino UNO

I am trying to Plot Transfer Characteristics of NPN Common Emitter BJT . collector emitter voltage versus collector current in X-axis Versus Y-axis. Whileusing voltage and current of step 30, Then it gives the correct values in Excel sheet and when we reduced or increased the step size of 30, it gives very large error. Can anybody tell why it is happening? if it gives correct value at step of 30 then it should also give correct value at another step size. i am attaching program.

#include <rExcel.h>
//int           outputTiming = 1000;
long          idx = 1;
char          value[16];
int ini=0;

//float rnd;
rExcel        myExcel; 
int pwmOut1=3;
int pwmOut2=11;
int  i,readValue1,readValue2,readValue3;
float VB[30],VBE[30],IB[30],VCE[30],IC[30];

void setup() {
 // put your setup code here, to run once:

Serial.begin(9600);
delay(1000);
myExcel.clearInput();
 //randomSeed(analogRead(5));
pinMode(pwmOut1, OUTPUT);
pinMode(pwmOut2, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
}

void loop()
{
 analogWrite(pwmOut1,204);

if (ini==0){
 idx=1;
  //analogWrite(pwmOut1,204);
for (i=ini; i<=255;)
{
 analogWrite(pwmOut2,i);
readValue1=analogRead(A0);
 readValue2=analogRead(A1);
  readValue3=analogRead(A2);
 VBE[i] = (5./1023.)*readValue1;
 VB[i] = (5./1023.)*readValue2;
 VCE[i] = (5./1023.)*readValue3;
 IB[i] = (VBE[i]-VB[i])*(1./660.);
 IC[i]=330*IB[i];

  myExcel.writeIndexed("bjtchar", idx, 1, idx); 
   myExcel.writeIndexed("bjtchar", idx, 2, VCE[i],2 );
   myExcel.writeIndexed("bjtchar", idx, 3, IC[i],2 );
   
Serial.println(i);
i=i+30;
delay(500);
 idx++;
}
}

else {
 ini=i-30; idx--;
 for (i=ini; i>0;)
{
 
 analogWrite(pwmOut2,i);
readValue1=analogRead(A0);
 readValue2=analogRead(A1);
  readValue3=analogRead(A2);
 VBE[i] = (5./1023.)*readValue1;
 VB[i] = (5./1023.)*readValue2;
 VCE[i] = (5./1023.)*readValue3;
 IB[i] = (VBE[i]-VB[i])*(1./660.);
 IC[i]=330*IB[i];

  //myExcel.writeIndexed("bjtchar", idx, 1, idx); 
   myExcel.writeIndexed("bjtchar", idx, 2, VCE[i],2 );
   myExcel.writeIndexed("bjtchar", idx, 3, IC[i],2 );
   Serial.println(i);
i=i-30;
delay(500);
 idx--;
}
}
}

Moderator: Code tags added.

Please edit your post to add code tags, so that it

looks like this.

See the "How to use this forum" post.

it gives very large error.

Give details, please.

Post a link to where you downloaded the Excel library.

Show us a good schematic of your circuit.
Show us a good image of your wiring.

Actually i have downloaded a software named excel commander which is interfaced with Arduino and Excel 2013

7896792575:
Actually i have downloaded a software named excel commander which is interfaced with Arduino and Excel 2013

So what?

.