No BSD License  

Highlights from
GUI for the performance analysis of pedelecs

image thumbnail
from GUI for the performance analysis of pedelecs by Jan Cappelle
Modeling the behaviour of electric bicycles

contourplot_forces(model,Z,vmax,Tmax,Pmax,deltav,deltaT,tit)
function contourplot_forces(model,Z,vmax,Tmax,Pmax,deltav,deltaT,tit)
%PLOT_FORCES3D
%plot_forces3D(model,Z,vmax,Tmax,Pmax,deltav,deltaT,tit,cmap)
%this function plots the 3D traction force as a function of speed and
%torque for a given model, maximum values for speed, torque and power
%should be given, and also speedstep and torquestep, a title and a colormap
%are inputs.

if not(isnumeric(model))
% if isnumeric(model)
%     errordlg('the requested model does not exist in the given directory','bad input','modal')
% else

% make a new grid with max speed, max Torque and Speed step and Torque step
vgrid = 0:deltav:vmax;
Tgrid = 0:deltaT:Tmax;

for k=1:length(vgrid)
hulp(((k-1)*(length(Tgrid))+1):k*length(Tgrid),:)=[vgrid(k).*ones(length(Tgrid),1) Tgrid'];
end
Xnew = hulp;
Ynew = simlssvm(model,Xnew);

%Remove point above the powerlimit and the torquelimit
for i=1:length(Xnew)
    if or(Xnew(i,1)/3.6*Xnew(i,2)/Z>Pmax,Ynew(i)>120)
            Ynew(i)=NaN;
        end
        if Xnew(i,2)>Tmax
            Ynew(i)=NaN;
        end
    end

    
%Prepare to mesh
[Xen Yen]=meshgrid(vgrid,Tgrid);

for k=1:length(vgrid)
        ZZ(:,k)=Ynew(((k-1)*length(Tgrid))+1:k*length(Tgrid));
end  

  
set(text,'fontsize',12)
[C,h]=contour(Xen,Yen,ZZ);
clabel(C,h);
axis([0 vmax 0 Tmax]);
title(tit,'fontsize',14)
xlabel('Speed [km/h]')
ylabel('Torque [Nm]')

else
     errordlg('there are no models found for this assistance mode','Bad Input','modal')
end
%end

Contact us at files@mathworks.com