clc
clear all
syms test0 ee f12 f13 k Te
tcpu0=cputime; % time cero of the program
offsettiempo=0.0; % offset of time for Vf
batt=100; % voltage og power supply
smooth=101;
colum1=3;
colum2=4;
base1='/Users/marcomartinez/Documents/GOLEM/';base2='/';
base31='niturbo';
dataTe=load(strcat(base1,base31));
baseg='Te';
basecsv1='.txt';
titlecsv=strcat(base1,baseg,basecsv1);
Tex=size(10000);
Te=size(10000);MdTe=size(1000000);
dTe=size(100000);
dxTe=size(100000);
off=size(100000);
k = 1.3806504*10^-23; % constant of Boltzman
ee=1.602176565*10^-19; % electric charge
offset=1000; % offset
% offset
n3=0;
off(1)=0;
for i=1:offset
off(i)=n3+dataTe(i,colum1);
n3=off(i);
end
n3=n3/offset;
n4=0;
off(1)=0;
for i=1:offset
off(i)=n4+dataTe(i,colum2);
n4=off(i);
end
n4=n4/offset;
[nciclox,ncicloy]=size(dataTe);
data1=size(1000000);
data3=size(1000000);
for i=1:nciclox
data1(i)=dataTe(i,3)-n3;
data3(i)=dataTe(i,4)-n4;
end
% V13
dataTee=size(10000000);
[nx,ny]=size(dataTe);
for i=1:nx
dataTee(i)=data1(i)-data3(i);
end
% offset in time, and cut data
ndata=nx;
offnd=0;
deltat=floor(offsettiempo/((dataTe(2,1)-dataTe(1,1))*1E+6));
for i=1:ndata
dTe(i) = dataTee(i+deltat+offnd)*100;
dxTe(i) = dataTe(i+offnd,1);
end
% Te
MTem=0;MdTe=0;
for i=1:ndata
if (dTe(i)>1E-50 && dTe(i)<30E+0) % conditions
stp=0;
Te(i)=11600*1; % Value initial of Te
while stp<1
lhs=(1-exp(-ee*dTe(i)/(k*Te(i))))/(1-exp(-ee*batt/(k*Te(i))));
test=abs(0.5-lhs);
if(test<1E-15)
stp=1;
else
Te(i) = Te(i)*lhs/0.5;
end
end
Tex(i)=Te(i)/11600;
if (Tex(i)>1E+10)
Tex(i) = Tex(i);
else
Tex(i) = Tex(i);
end
if (Tex(i)<0E+1)
Tex(i) = 0;
else
Tex(i) = Tex(i);
end
else
Tex(i)=0;
end
if (dTe(i)>=MdTe)
MdTe=dTe(i); % V13 max
else
end
end
cd(base1)
f=figure;
x0=7;x1=19;
V130=-10;V131=30;
Te0=-10;Te1=40;
subplot(2,1,1),plot(dxTe(:)*1E+3,dTe(:));
%title(ShotNo);
%xlabel('Time [ms]');
ylabel('V_1_-_3 [V]');
%legend('V_1_-_3');
axis([x0 x1 V130 V131]);
subplot(2,1,2),plot(dxTe(:)*1E+3,Tex(:));
%title(ShotNo);
xlabel('Time [ms]');
ylabel('Te [eV]');
%legend('Electron Temperature');
axis([x0 x1 Te0 Te1]);
saveas(f, 'Te', 'png');
csvwrite(titlecsv,[dxTe(:),dTe(:),Tex(:)]);
FID = fopen('index.html', 'w');
fprintf(FID,'<html><body><h1>Triple probe analysis</h1><h2><a href="TE.m">matlab code used</a></h2><img src="Te.png"/><hr/><a
href="Te.txt">Data</a></body></html>');
fclose(FID);
!zip results index.html Te.png Te.txt
