function [ksiMAt ksiMA] = constantwattksi(modelZA,modelMA,Z,P,ds)
%constantwatt(model,Z,P) selects the values from the model in the operation points
%with the same power input P. The distance on the constant power curve is
%ds. Normally ds is taken as 1. Z is the transmission rate of the given
%model.
c=P*3.6*Z;
vmax=25;
Tmax=75;
Tmin=c/vmax;
vmin=c/Tmax;
y(1)=Tmax;
ynew(1)=y(1);
%x=vmin:0.1:vmax;
x(1)=vmin;
k=1;
while x(k)<vmax
dx(k)=ds/(sqrt(1+c^2/x(k)^4));
x(k+1)=x(k)+dx(k);
k=k+1;
end
xnew=x;
ynew=c./xnew;
Xnew=[xnew',ynew'];
YZA=simlssvm(modelZA,Xnew);
YMA=simlssvm(modelMA,Xnew);
PtZA=YZA.*(xnew'/3.6);
PtMA=YMA.*(xnew'/3.6);
WtZA=mean(PtZA)
WtMA=mean(PtMA);
WtmMA=WtMA-WtZA;
ksiMA=WtmMA/WtMA;
%not necessary, input is always 50!!
% n=1;
% for k=1:length(PtZA)
% if PtZA(k)>2
% PtmMA(n)=PtMA(k)-PtZA(k);
% PtZAf(n)=PtZA(k);
% n=n+1;
% end
% end
%size(PtZAf)
%size(PtZA)
PtmMA=PtMA-PtZA;
ksiMAt=PtmMA./PtMA;