function varargout = Performance_Plots(varargin)
%PERFORMANCE_PLOTS M-file for Performance_Plots.fig
% PERFORMANCE_PLOTS, by itself, creates a new PERFORMANCE_PLOTS or raises the existing
% singleton*.
%
% H = PERFORMANCE_PLOTS returns the handle to a new PERFORMANCE_PLOTS or the handle to
% the existing singleton*.
%
% PERFORMANCE_PLOTS('Property','Value',...) creates a new PERFORMANCE_PLOTS using the
% given property value pairs. Unrecognized properties are passed via
% varargin to Performance_Plots_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% PERFORMANCE_PLOTS('CALLBACK') and PERFORMANCE_PLOTS('CALLBACK',hObject,...) call the
% local function named CALLBACK in PERFORMANCE_PLOTS.M with the given input
% arguments.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Performance_Plots
% Last Modified by GUIDE v2.5 02-Feb-2007 11:03:17
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Performance_Plots_OpeningFcn, ...
'gui_OutputFcn', @Performance_Plots_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Performance_Plots is made visible.
function Performance_Plots_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
% Choose default command line output for Performance_Plots
handles.output = hObject;
handles.folderput=0; %says if folder input is given
addpath(genpath(fullfile(matlabroot,'toolbox\Pedelecs')));
addpath(genpath(fullfile(matlabroot,'toolbox\LSSVM\LS-SVMlab1.5')));
handles.Plottype=1;
%Determine some constants for plotting
handles.vmax=25;
handles.Tmax=80;
handles.Pmax=400;
handles.deltav=0.5;
handles.deltaT=1;
%initialize the checkboxes
handles.ZA1=0;
handles.MA1=0;
handles.MA2=0;
handles.MA3=0;
handles.velocities=[5 10 15];
handles.Mped=30;
handles.Mcyc=70;
handles.PlotName=0;
handles.ThisPlot=plot(0,0);
%initializes the radiobutton performance parameter
handles.PP=1;
%initializes the total mass
handles.mtot=100;
%update the handles
guidata(hObject, handles);
% UIWAIT makes Performance_Plots wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Performance_Plots_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in ZA.
function ZA1_Callback(hObject, eventdata, handles)
% hObject handle to ZA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.ZA1=get(hObject,'Value');
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of ZA
% val=get(hObject,'Value')
% model=get(ReadModel.handles.Load1)
% if val==1
% axes(handles.Figuurveld)
% plotlssvm_GUI1(model,'Traction force without assistance','Cyclist Torque T_c [Nm]','Speed v [km/h]','Traction Force F_t [N]',handles.Z);
% end
% --- Executes on button press in MA1.
function MA1_Callback(hObject, eventdata, handles)
% hObject handle to MA1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.MA1=get(hObject,'Value');
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of MA1
% --- Executes on button press in MA2.
function MA2_Callback(hObject, eventdata, handles)
% hObject handle to MA2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.MA2=get(hObject,'Value');
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of MA2
% --- Executes on button press in MA3.
function MA3_Callback(hObject, eventdata, handles)
% hObject handle to MA3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.MA3=get(hObject,'Value');
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of MA3
% --- Executes on button press in Action.
function Action_Callback(hObject, eventdata, handles)
% hObject handle to Action (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%addpath where plotfunctions are defined
%Get the models from file
%And create a variable 'avail' which is 1 1 1 1 1 1 if all models exist
%Load the pedelec.mat file with all model data
%create an empty plot to avoid overwriting of plots in the figure(10)
%handle
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot(NaN,NaN)
if handles.folderput==0 %no given directory
errordlg('There is no directory selected to look for the model datafile','Bad Input','modal')
elseif handles.folderput==1 %there is a directory given
newpath=get(handles.SourceFolder,'string');
probfile=fullfile(newpath,'pedelec.mat');%look for the 'folder/pedelec.mat'
if exist(probfile)==0 %the dir has no pedelec.mat file
errordlg('There was no pedelec.mat file found in the given directory','Bad Input','modal')
elseif exist(probfile)~=0 %the dir has a pedelec.mat file
probdata=load(probfile);
if isfield(probdata,'vTcModels') %look for Ft(v,Tc) models and tell which of the 6 are available
%create a list with available models
modellist=fieldnames(probdata.vTcModels);
comparelist={'ZA','MAe','MAn','MAp','ETA','KSI'};
for k=1:length(comparelist)
if sum(strcmp(modellist,comparelist(k)))~=0
avail(k)=1;
else
avail(k)=0;
end
end
name=probdata.pname;
name=name(1);
Z=str2double(probdata.pZ);%define the models
if avail(1)==1
modelZA=probdata.vTcModels.ZA;
else
modelZA=0;
end
if avail(2)==1
modelMAe=probdata.vTcModels.MAe;
else
modelMAe=0;
end
if avail(3)==1
modelMAn=probdata.vTcModels.MAn;
else
modelMAn=0;
end
if avail(4)==1
modelMAp=probdata.vTcModels.MAp;
else
modelMAp=0;
end
if avail(5)==1
modelETA=probdata.vTcModels.ETA;
else
modelETA=0;
end
if avail(6)==1
modelKSI=probdata.vTcModels.KSI;
else
modelKSI=0;
end
else avail=zeros(1,6);
end
%What are the values of the checkboxes
what=[handles.ZA1 handles.MA1 handles.MA2 handles.MA3];
%What is requested?
%Possibilities
%[1 0 0 0 0 0]
%request=select_model2(handles.PP,what,avail);
%if request~=[0 0 0 0 0 0]
%What PP is selected
if handles.PP==1
%In the case a 3D plot is selected
if sum(avail)==0
errordlg('Seems like there''s not enough information in the destination folder to create the requested plot','Bad Input','modal')
elseif sum(what)==0 % request is [0 0 0 0 0 0]
errordlg('Please select an assistance mode','Bad Input','modal')
elseif sum(what(1:4))==1 % only one is checked
if what(1)==1
model_to_plot=modelZA;
tit='Traction force without assistance [N]';
cmap=bone;
elseif what(2)==1
model_to_plot=modelMAe;
tit='Traction force with eco assistance [N]';
cmap=winter;
elseif what(3)==1
model_to_plot=modelMAn;
tit='Traction force with normal assistance [N]';
cmap=summer;
elseif what(4)==1
model_to_plot=modelMAp;
tit='Traction force with power assistance [N]';
cmap=autumn;
end
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
plot_forces3D(model_to_plot,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit,cmap);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_forces3D(model_to_plot,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit,cmap);
elseif handles.Plottype==2 %=> contourplot
colormap('default')
contourplot_forces(model_to_plot,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
colormap('default')
contourplot_forces(model_to_plot,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit);
elseif handles.Plottype==3 %=> slicesplot
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
elseif handles.Plottype==4 %sices of constant T
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
Tslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
Tslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
end
else %more than one is checked
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
%a nonsense plot to clear the former plots
h=plot3(0,0,0);
clear h
plot_forces3D_more(modelZA,modelMAe,modelMAn,modelMAp,avail,what,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_forces3D_more(modelZA,modelMAe,modelMAn,modelMAp,avail,what,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
elseif handles.Plottype==2
errordlg('Only one mode may be checked for contourplots','Bad Input','modal')
elseif handles.Plottype==3
%axes(handles.axes2)
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
elseif handles.Plottype==4 %sices of constant T
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
Tslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
Tslicesplot_forces(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
end
end
elseif handles.PP==2 %the efficiency model is requested
if or(sum(what)~=1,what(1)~=1)
errordlg('The efficiency is only available in the non-assisted mode','Bad Input','modal')
elseif avail(5)==0
errordlg('Seems like the model for the efficiency is not available in the given directory','Bad Input','modal')
elseif handles.Plottype==1
axes(handles.axes2)
plot_eta3D(modelETA,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'3D mechanical efficiency plot',autumn);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_eta3D(modelETA,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'3D mechanical efficiency plot',autumn);
elseif handles.Plottype==2
axes(handles.axes2)
colormap('default')
contourplot_forces(modelETA,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Mechanical efficiency contourplot');
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
colormap('default')
contourplot_forces(modelETA,Z,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Mechanical efficiency contourplot');
elseif handles.Plottype==3
errordlg('no slice plots available for the effiency')
elseif handles.Plottype==4
errordlg('no slice plots available for the effiency')
end
elseif handles.PP==3 %the assistance factor model is requested
if sum(avail)==0
errordlg('Seems like there''s not enough information in the destination folder to create the requested plot','Bad Input','modal')
elseif what(1)==1 %the zero assistance mode has no assistance factor
errordlg('The Asstance Factor is only determined for motor assistance modes','bad input','modal')
else
if sum(what(1:4))==1 % only one is checked
if what(2)==1
tit='Assistance factor in eco-assistance mode [%]';
ksimode=1;
elseif what(3)==1
tit='Assistance factor in normal assistance mode [%]';
ksimode=2;
elseif what(4)==1
tit='Assistance factor in power assistance mode [%]';
ksimode=3;
end
else %more than one is checked
tit='Assistance factor';
ksimode=4;
end
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
h=plot3(0,0,0);
clear h
plot_ksi3D(modelKSI,avail,what,Z,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
h=plot3(0,0,0);
clear h
plot_ksi3D(modelKSI,avail,what,Z,tit);
elseif handles.Plottype==2 %contourplots
if ksimode==4
errordlg('Contourplots can only be made for a single motor assistance','bad input','modal')
else
h=plot(0,0);
clear h
colormap('default')
contourplot_ksi(modelKSI,ksimode,Z,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
h=plot(0,0);
clear h
colormap('default')
contourplot_ksi(modelKSI,ksimode,Z,tit);
end
elseif handles.Plottype==3
vs=handles.velocities;
h=plot(0,0);
clear h
vslicesplot_ksi(modelKSI,avail,what,vs,Z,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
h=plot(0,0);
clear h
vslicesplot_ksi(modelKSI,avail,what,vs,Z,tit);
elseif handles.Plottype==4
vs=handles.velocities;
models=probdata.vTcModels;
tit=('The assistance factor');
h=plot(0,0);
clear h
%Tslicesplot_ksi(models,avail,what,vs,Z,tit);
Tslicesplot_ksi2(modelKSI,avail,what,vs,Z,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
h=plot(0,0);
clear h
Tslicesplot_ksi2(modelKSI,avail,what,vs,Z,tit);
end
end
elseif handles.PP==4 %the slope ability factor model is requested
handles.mtot=handles.Mped+handles.Mcyc;%determine total weight
if sum(avail)==0
errordlg('Seems like there''s not enough information in the folder to create the requested plot','Bad Input','modal')
elseif sum(what(1:4))==1 % only one is checked
if what(1)==1
model_to_plot=modelZA;
tit='Slope-Ability without assistance [%]';
cmap=bone;
elseif what(2)==1
model_to_plot=modelMAe;
tit='Slope-Ability with eco assistance [%]';
cmap=winter;
elseif what(3)==1
model_to_plot=modelMAn;
tit='Slope-Ability with normal assistance [%]';
cmap=summer;
elseif what(4)==1
model_to_plot=modelMAp;
tit='Slope-Ability with power assistance [%]';
cmap=autumn;
end
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
plot_SA3D(model_to_plot,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit,cmap);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_SA3D(model_to_plot,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit,cmap);
elseif handles.Plottype==2 %=> contourplot
colormap('default')
contourplot_SA(model_to_plot,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
colormap('default')
contourplot_SA(model_to_plot,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,tit);
elseif handles.Plottype==3 %=> slicesplot
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
elseif handles.Plottype==4 %=> slicesplot T
h=plot(0,0);
clear h
v=handles.velocities;
Tslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
Tslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
end
else %more than one is checked
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
%a nonsense plot to clear the former plots
h=plot3(0,0,0);
clear h
plot_SA3D_more(modelZA,modelMAe,modelMAn,modelMAp,avail,what,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,1,2,'Slope-Ability')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_SA3D_more(modelZA,modelMAe,modelMAn,modelMAp,avail,what,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,1,2,'Slope-Ability')
elseif handles.Plottype==2
errordlg('Only one mode may be checked for contourplots','Bad Input','modal')
elseif handles.Plottype==3
axes(handles.axes2)
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
elseif handles.Plottype==4 %=> slicesplot T
h=plot(0,0);
clear h
v=handles.velocities;
Tslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
Tslicesplot_SA(modelZA,modelMAe,modelMAn,modelMAp,avail,what,v,Z,handles.mtot,handles.vmax,handles.Tmax,handles.Pmax,handles.deltav,handles.deltaT,'Slope-Ability')
end
end
elseif handles.PP==5 %The required cyclist torque
name=probdata.pname;
name=name(1);
Z=str2double(probdata.pZ);%define the models
[models2 avail2]=makeCTmodels2(probdata);%collects CTmodels and tells which are available
if sum(avail2)==0
errordlg('There were no Tc(v,Ft) models found in the pedelec.mat file of the given directory','Bad Input','modal')
elseif sum(what)==0
errordlg('Please select an assistance mode','Bad Input','modal')
elseif sum(what(1:4))==1 % only one is checked
if what(1)==1
model_to_plot=models2.ZA;
tit='Required cyclist torque without assistance [Nm]';
cmap=bone;
elseif what(2)==1
model_to_plot=models2.MAe;
tit='Required cyclist torque with eco assistance [Nm]';
cmap=winter;
elseif what(3)==1
model_to_plot=models2.MAn;
tit='Required cyclist torque with normal assistance [Nm]';
cmap=summer;
elseif what(4)==1
model_to_plot=models2.MAp;
tit='Required cyclist torque with power assistance [Nm]';
cmap=autumn;
end
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
plot_torques3D(model_to_plot,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,0.5,0.5,tit,cmap);
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off');
plot_torques3D(model_to_plot,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,0.5,0.5,tit,cmap);
elseif handles.Plottype==2 %=> contourplot
colormap('default')
contourplot_torques(model_to_plot,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,tit);
handles.ThisPlot=figure(10)
set(handles.ThisPlot,'Visible','off')
colormap('default')
contourplot_torques(model_to_plot,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,tit);
elseif handles.Plottype==3 %=> slicesplot
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_torques(models2,avail2,what,v,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_torques(models2,avail2,what,v,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,'Traction forces')
elseif handles.Plottype==4
errordlg('no slices available for this plot','bad input','modal')
end
else %more than one is checked
axes(handles.axes2)
if handles.Plottype==1 %=> 3D plots
%a nonsense plot to clear the former plots
h=plot3(0,0,0);
clear h
plot_torques3D_more(models2,avail2,what,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,1,2,'Required Cyclist Torque')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot_torques3D_more(models2,avail2,what,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,1,2,'Required Cyclist Torque')
elseif handles.Plottype==2
errordlg('Only one mode may be checked for contourplots','Bad Input','modal')
elseif handles.Plottype==3
%a nonsense plot to clear the former plots
h=plot(0,0);
clear h
v=handles.velocities;
vslicesplot_torques(models2,avail2,what,v,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,'Required Cyclist Torque')
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
vslicesplot_torques(models2,avail2,what,v,Z,handles.vmax,handles.Tmax/Z,handles.Pmax,handles.deltav,handles.deltaT,'Required Cyclist Torque')
elseif handles.Plottype==4
errordlg('no slices available for this plot','bad input','modal')
end
end
elseif handles.PP==6 %the measurements are asked
databank=probdata.vTcData;
dont=0
if sum(avail)==0
errordlg('There are no measurements found in the pedelec.mat file of the given directory','Bad Input','modal')
elseif sum(what)==0
errordlg('Please select an assistance mode','Bad Input','modal')
elseif sum(what(1:4))==1 % only one is checked
if what(1)==1
datatra=databank.ZA.tradata;
datatest=databank.ZA.testdata;
tit='Measurements without assistance power';
elseif what(2)==1
datatra=databank.MAe.tradata;
datatest=databank.MAe.testdata;
tit='Measurements with economic assistance power';
elseif what(3)==1
datatra=databank.MAn.tradata;
datatest=databank.MAn.testdata;
tit='Measurements with normal assistance power';
elseif what(4)==1
datatra=databank.MAp.tradata;
datatest=databank.MAp.testdata;
tit='Measurements with normal assistance power';
end
elseif sum(what)>1
dont=1;
end
if handles.Plottype~=1
dont=1;
end
if dont==0
axes(handles.axes2)
plot3(datatra(:,1),datatra(:,2),datatra(:,3),'r.',datatest(:,1),datatest(:,2),datatest(:,3),'g.')
legend('trainingsdata','testdata','Location','NorthEast');
grid on
view(-60,30);
axis([0 30 0 80 0 120])
title(tit,'fontsize',14)
xlabel('v [km/h]','rotation',30)
zlabel('F_t [N]','rotation',90)
ylabel('T_c [Nm]','rotation',-10)
handles.ThisPlot=figure(10);
set(handles.ThisPlot,'Visible','off')
plot3(datatra(:,1),datatra(:,2),datatra(:,3),'r.',datatest(:,1),datatest(:,2),datatest(:,3),'g.')
legend('trainingsdata','testdata','Location','NorthEast');
grid on
view(-60,30);
axis([0 30 0 80 0 120])
title(tit,'fontsize',14)
xlabel('v [km/h]','rotation',30)
zlabel('F_t [N]','rotation',90)
ylabel('T_c [Nm]','rotation',-10)
else
errordlg('no measurement plot possible for this request','bad input','modal')
end
end
end
end
guidata(hObject,handles);
%[0 0 0 0 0 0 ] do nothing when the request is not ok!
%end
% --- Executes on selection change in Plottype.
function Plottype_Callback(hObject, eventdata, handles)
% hObject handle to Plottype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns Plottype contents as cell array
% contents{get(hObject,'Value')} returns selected item from Plottype
val = get(hObject,'Value');
switch val
case 1
handles.Plottype=1;
case 2
handles.Plottype=2;
case 3
handles.Plottype=3;
case 4
handles.Plottype=4;
end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function Plottype_CreateFcn(hObject, eventdata, handles)
% hObject handle to Plottype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function velocities_Callback(hObject, eventdata, handles)
% hObject handle to velocities (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of velocities as text
% str2double(get(hObject,'String')) returns contents of velocities as a double
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
handles.velocities=str2num(get(hObject,'String')); %hoe matrix inlezen
disp(handles.velocities);
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function velocities_CreateFcn(hObject, eventdata, handles)
% hObject handle to velocities (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in checkbox6.
function f_Callback(hObject, eventdata, handles)
% hObject handle to checkbox6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox6
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=1;
else
handles.PP=0;
end
guidata(hObject, handles);
% --- Executes on button press in checkbox7.
function eta_Callback(hObject, eventdata, handles)
% hObject handle to checkbox7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=2;
else
handles.PP=0;
end
% Hint: get(hObject,'Value') returns toggle state of checkbox7
guidata(hObject,handles);
% --- Executes on button press in checkbox8.
function ksi_Callback(hObject, eventdata, handles)
% hObject handle to checkbox8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=3;
else
handles.PP=0;
end
% Hint: get(hObject,'Value') returns toggle state of checkbox8
guidata(hObject,handles);
% --- Executes on button press in checkbox8.
function SA_Callback(hObject, eventdata, handles)
% hObject handle to checkbox8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=4;
else
handles.PP=0;
end
% Hint: get(hObject,'Value') returns toggle state of checkbox8
guidata(hObject,handles);
function Mped_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
handles.Mped=str2double(get(hObject,'String'));
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function Mped_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Mcyc_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
handles.Mcyc=str2double(get(hObject,'String'));
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function Mcyc_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function SourceFolder_Callback(hObject, eventdata, handles)
% hObject handle to SourceFolder (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=get(hObject,'string');
set(handles.SourceFolder,'string',a);
handles.folderput=1;
guidata(hObject,handles);
% Hints: get(hObject,'String') returns contents of SourceFolder as text
% str2double(get(hObject,'String')) returns contents of SourceFolder as a double
% --- Executes during object creation, after setting all properties.
function SourceFolder_CreateFcn(hObject, eventdata, handles)
% hObject handle to SourceFolder (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in FolderBrowse.
function FolderBrowse_Callback(hObject, eventdata, handles)
% hObject handle to FolderBrowse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DirName = uigetdir('C:\','Select the models directory');
handles.folderput=1;
set(handles.SourceFolder,'string',DirName);
guidata(hObject,handles);
% --- Executes on button press in SavePlot.
function SavePlot_Callback(hObject, eventdata, handles)
% hObject handle to SavePlot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.PlotName==0
errordlg('Please enter a name for the plot','bad input','modal')
else
filename2=cd;
filename1=get(handles.SourceFolder,'string');
name=handles.PlotName;
cd(filename1)
print('-f10','-depsc', name)
cd(filename2)
end
function PlotName_Callback(hObject, eventdata, handles)
% hObject handle to PlotName (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of PlotName as text
% str2double(get(hObject,'String')) returns contents of PlotName as a double
handles.PlotName=get(hObject,'String');
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function PlotName_CreateFcn(hObject, eventdata, handles)
% hObject handle to PlotName (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in editplot.
function editplot_Callback(hObject, eventdata, handles)
% hObject handle to editplot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.ThisPlot,'Visible','on')
guidata(hObject,handles);
% --- Executes on button press in TC.
function TC_Callback(hObject, eventdata, handles)
% hObject handle to TC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of TC
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=5;
else
handles.PP=0;
end
guidata(hObject, handles);
% --- Executes on button press in Measurements.
function Measurements_Callback(hObject, eventdata, handles)
% hObject handle to Measurements (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of Measurements
if (get(hObject,'Value') == get(hObject,'Max'))
handles.PP=6;
else
handles.PP=0;
end
guidata(hObject, handles);