clear;
y=xlsread('E:\works\项目\MC100\电机台架数据\鲨湾96v电机145外特性.xlsx','MAP1','A26:A33'); % torque
x=xlsread('E:\works\项目\MC100\电机台架数据\鲨湾96v电机145外特性.xlsx','MAP1','W26:W33'); % D
z=xlsread('E:\works\项目\MC100\电机台架数据\鲨湾96v电机145外特性.xlsx','MAP1','X26:X33'); % Q
y=abs(y);
% Te = 1.5*4*(a*iq + (ld - lq)*idiq);
ft=fittype('6*(a*iq-(l)*id*iq)', 'independent',{'id','iq'}, 'coefficients', {'a', 'l'});
%ld=0.000070;
%lq=0.000140;
ft=fittype('6*(0.0232*iq+(ld-lq)*id*iq)', 'independent',{'id','iq'}, 'coefficients', {'ld', 'lq'});

Y=fit([x,z],y,ft,'StartPoint',[0.00070, 0.000150])


Y=fit([x,z],y,ft,'StartPoint',[0.023, 0.00007])
