ClearAll["Global`*"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];

FileNames[]

data1=<<"dataTrafo";
(*Get["dataTrafo"]*)
ListPlot[data1,AxesLabel->{"Ueff","Ief"},PlotRange->All]

data1

ω=2.*Pi*50;
data2=data1/.{u_,i_}:>{((u*(Sqrt[2]))/ω),i};
ListPlot[data2,AxesLabel->{"ϕ","Ief"},PlotRange->All]

fim=820;
a=Fit[Select[data2,#[[1]]<fim&],fi,fi][[1]];

(*test[{fi_,i_}]:=fi<fim;
Select[data2,test]*)

(*Fit[Select[data2,#[[1]]<fim&],fi,fi][[1]]*)

(*a=Fit[Select[data2,#[[1]]<fim&],fi,fi]/.fi->1*)

(*D[Fit[Select[data2,#[[1]]<fim&],fi,fi],fi]*)

fce[fi_,b_,c_]:=a*fi+b*fi*((((fi^2)))^c);
T=((2.Pi)/ω);
effHodnota[fiAmpl_,b_,c_]:=√((1/T)*NIntegrate[fce[fiAmpl*((Sin[ω*t])^2),b,c],{t,0,T}]);
effHodnota[10,1,0.3]

norm[x_]:=(x^2);
error[{fiAmpl_,ieff_},{b_,c_}]:=norm[effHodnota[fiAmpl,b,c]-ieff];

k=0.005;
Plot[(Sqrt[(x^2)+(k^2)])-k,{x,-0.5,0.5}]

(*myInt[expr_]:=Module[{rce, poc,y},
rce=y'[t]==expr;
poc=y[0]==0;
y[T]/.NDSolve[{rce,poc},y,{t,0,T}][[1]]
];
myInt[((Cos[ω*t])^2)]*)

(*effHodnota[fiAmpl_,b_,c_]:=√((1/T)*myInt[fce[fiAmpl*((Sin[ω*t])^2),b,c]]);
effHodnota[10,1,0.3]//Timing*)

(*Integrate[fce[fiAmpl*((Sin[ω*t])^2),b,c],{t,0,T}]*)