classdef app1import < matlab.apps.AppBase
properties (Access = public)
UIFigure matlab.ui.Figure
InducedvoltagevsspeedButton matlab.ui.control.Button
AvgPowervsEffButton matlab.ui.control.Button
SpeedvsTorquevsPowerButton matlab.ui.control.Button
torquevsSpeedButton matlab.ui.control.Button
ImportdataButton matlab.ui.control.Button
UIAxes4 matlab.ui.control.UIAxes
UIAxes3 matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
UIAxes matlab.ui.control.UIAxes
end
properties (Access = public)
Property
A
end
methods (Access = private)
function startupFcn(app)
yyaxis(app.UIAxes,'right')
app.UIAxes.YLabel.String='Power (kW)';
app.UIAxes.YColor = [1 0 0];
yyaxis(app.UIAxes,'left')
app.UIAxes.YLabel.String='Torque(Nm)';
app.UIAxes.Color = [1 1 0.8];
app.UIAxes.XLabel.String='Speed(RPM)'
app.UIAxes.XGrid = 'on';
app.UIAxes.YGrid = 'on';
end
function ImportdataButtonPushed(app, event)
[file,path,~]=uigetfile('*.csv');
t=fullfile(path,file);
app.A = readtable(t);
app.A.P_SigmaA_Total_WT1=(app.A.P_SigmaA_Total_WT1)./1000;
app.A.Time=time2num(app.A.Time,"minutes");
app.A.U_SigmaA_Total_WT1=(app.A.U_SigmaA_Total_WT1)./(1.732);
app.A.Eta1_1_Total_WT1=(app.A.Eta1_1_Total_WT1).*(1);
app.A.Speed_1_Total_WT1(ismissing(app.A.Speed_1_Total_WT1)) = 0;
app.A.Torque_1_Total_WT1(ismissing(app.A.Torque_1_Total_WT1)) = 0;
app.A.U_SigmaA_Total_WT1(ismissing(app.A.U_SigmaA_Total_WT1)) = 0;
app.A = app.A(app.A.Eta1_1_Total_WT1 >= 0 & app.A.Eta1_1_Total_WT1 <= 100,:);
app.A.Eta1_1_Total_WT1(ismissing(app.A.Eta1_1_Total_WT1)) = 0;
app.A.P_SigmaA_Total_WT1(ismissing(app.A.P_SigmaA_Total_WT1)) = 0;
end
function torquevsSpeedButtonPushed(app, event)
plot(app.UIAxes2,app.A.Torque_1_Total_WT1,app.A.Speed_1_Total_WT1)
title(app.UIAxes2, 'Speed vs Torque')
xlabel(app.UIAxes2, 'Speed (rpm)')
ylabel(app.UIAxes2, 'Torque(Nm)')
zlabel(app.UIAxes2, 'Z')
end
function SpeedvsTorquevsPowerButtonPushed(app, event)
yyaxis(app.UIAxes,'left')
plot(app.UIAxes,[app.A.Speed_1_Total_WT1],[app.A.Torque_1_Total_WT1]);
yyaxis(app.UIAxes,'right')
plot(app.UIAxes,[app.A.Speed_1_Total_WT1],[app.A.P_SigmaA_Total_WT1]);
title(app.UIAxes, 'Speed vs Torque vs Power')
end
function TorqueEditFieldValueChanged(app, event)
end
function UIAxesButtonDown(app, event)
end
function AvgPowervsEffButtonPushed(app, event)
plot(app.UIAxes3,[app.A.P_SigmaA_Total_WT1],[app.A.Eta1_1_Total_WT1]);
title(app.UIAxes3, 'Power(kW) vs Efficiency(%)')
xlabel(app.UIAxes3, 'Power(kW)')
ylabel(app.UIAxes3, 'Efficiency(%)')
end
function InducedvoltagevsspeedButtonPushed(app, event)
plot(app.UIAxes4,[app.A.Speed_1_Total_WT1],[app.A.U_SigmaA_Total_WT1 ])
title(app.UIAxes4, 'Speed(RPM) vs Induced Voltage(V)')
xlabel(app.UIAxes4, 'Speed (RPM)')
ylabel(app.UIAxes4, 'Induced voltage(V)')
end
end
methods (Access = private)
function createComponents(app)
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'Torque')
ylabel(app.UIAxes, 'Speed')
zlabel(app.UIAxes, 'Z')
app.UIAxes.XGrid = 'on';
app.UIAxes.XMinorGrid = 'on';
app.UIAxes.YGrid = 'on';
app.UIAxes.YMinorGrid = 'on';
app.UIAxes.ButtonDownFcn = createCallbackFcn(app, @UIAxesButtonDown, true);
app.UIAxes.Position = [363 287 266 194];
app.UIAxes2 = uiaxes(app.UIFigure);
title(app.UIAxes2, ' Torque vs Speed')
xlabel(app.UIAxes2, 'Torque(Nm)')
ylabel(app.UIAxes2, 'Speed (rpm)')
zlabel(app.UIAxes2, 'Z')
app.UIAxes2.XGrid = 'on';
app.UIAxes2.XMinorGrid = 'on';
app.UIAxes2.YGrid = 'on';
app.UIAxes2.YMinorGrid = 'on';
app.UIAxes2.Position = [40 297 247 184];
app.UIAxes3 = uiaxes(app.UIFigure);
title(app.UIAxes3, 'Power vs Efficiency')
xlabel(app.UIAxes3, 'Power (kW)')
ylabel(app.UIAxes3, 'Efficiency(%)')
zlabel(app.UIAxes3, 'Z')
app.UIAxes3.XMinorGrid = 'on';
app.UIAxes3.YMinorGrid = 'on';
app.UIAxes3.Position = [1 43 300 215];
app.UIAxes4 = uiaxes(app.UIFigure);
title(app.UIAxes4, 'Speed vs Induced voltage')
xlabel(app.UIAxes4, 'Speed (RPM)')
ylabel(app.UIAxes4, 'Induced voltage (V)')
zlabel(app.UIAxes4, 'Z')
app.UIAxes4.XGrid = 'on';
app.UIAxes4.XMinorGrid = 'on';
app.UIAxes4.YGrid = 'on';
app.UIAxes4.YMinorGrid = 'on';
app.UIAxes4.Position = [311 43 318 215];
app.ImportdataButton = uibutton(app.UIFigure, 'push');
app.ImportdataButton.ButtonPushedFcn = createCallbackFcn(app, @ImportdataButtonPushed, true);
app.ImportdataButton.Position = [242 257 100 22];
app.ImportdataButton.Text = 'Import data';
app.torquevsSpeedButton = uibutton(app.UIFigure, 'push');
app.torquevsSpeedButton.ButtonPushedFcn = createCallbackFcn(app, @torquevsSpeedButtonPushed, true);
app.torquevsSpeedButton.Position = [60 257 103 22];
app.torquevsSpeedButton.Text = 'torque vs Speed';
app.SpeedvsTorquevsPowerButton = uibutton(app.UIFigure, 'push');
app.SpeedvsTorquevsPowerButton.ButtonPushedFcn = createCallbackFcn(app, @SpeedvsTorquevsPowerButtonPushed, true);
app.SpeedvsTorquevsPowerButton.Position = [401 257 158 22];
app.SpeedvsTorquevsPowerButton.Text = 'Speed vs Torque vs Power';
app.AvgPowervsEffButton = uibutton(app.UIFigure, 'push');
app.AvgPowervsEffButton.ButtonPushedFcn = createCallbackFcn(app, @AvgPowervsEffButtonPushed, true);
app.AvgPowervsEffButton.Position = [98 10 106 22];
app.AvgPowervsEffButton.Text = 'Avg Power vs Eff';
app.InducedvoltagevsspeedButton = uibutton(app.UIFigure, 'push');
app.InducedvoltagevsspeedButton.ButtonPushedFcn = createCallbackFcn(app, @InducedvoltagevsspeedButtonPushed, true);
app.InducedvoltagevsspeedButton.Position = [418 10 152 22];
app.InducedvoltagevsspeedButton.Text = 'Induced voltage vs speed';
app.UIFigure.Visible = 'on';
end
end
methods (Access = public)
function app = app1import
createComponents(app)
registerApp(app, app.UIFigure)
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
function delete(app)
delete(app.UIFigure)
end
end
end