function varargout = nma_MAE121_spring_2010_lab4(varargin) %lab4 assignment MAE121 dynamics, UC david % NMA_MAE121_SPRING_2010_LAB4 MATLAB code for nma_MAE121_spring_2010_lab4.fig % NMA_MAE121_SPRING_2010_LAB4, by itself, creates a new NMA_MAE121_SPRING_2010_LAB4 or raises the existing % singleton*. % % H = NMA_MAE121_SPRING_2010_LAB4 returns the handle to a new NMA_MAE121_SPRING_2010_LAB4 or the handle to % the existing singleton*. % % NMA_MAE121_SPRING_2010_LAB4('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in NMA_MAE121_SPRING_2010_LAB4.M with the given input arguments. % % NMA_MAE121_SPRING_2010_LAB4('Property','Value',...) creates a new NMA_MAE121_SPRING_2010_LAB4 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before nma_MAE121_spring_2010_lab4_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to nma_MAE121_spring_2010_lab4_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % GUI file for my nma_MAE121_spring_2010_lab4 assignment, UC davis, spring 2011 EME121 % by Nasser M. Abbasi % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help nma_MAE121_spring_2010_lab4 % Last Modified by GUIDE v2.5 16-Feb-2012 23:33:02 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @nma_MAE121_spring_2010_lab4_OpeningFcn, ... 'gui_OutputFcn', @nma_MAE121_spring_2010_lab4_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 nma_MAE121_spring_2010_lab4 is made visible. function nma_MAE121_spring_2010_lab4_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 command line arguments to nma_MAE121_spring_2010_lab4 (see VARARGIN) % Choose default command line output for nma_MAE121_spring_2010_lab4 handles.output = hObject; %nma_set_figure_position(handles.figure1,0.1,0.1,.75,.79); set(handles.figure1, 'UserData',[]); set(handles.figure1,'Name','UC Davis, EME 121 lab#4, by Nasser M. Abbasi'); userData.stop = false; set(handles.figure1, 'UserData',userData); contents = cellstr(get(handles.criticalMultiplierTag,'String')); criticalMultipler=str2num(contents{get(handles.criticalMultiplierTag,... 'Value')}); updateUnstable(criticalMultipler,handles); % Update handles structure guidata(hObject, handles); % UIWAIT makes nma_MAE121_spring_2010_lab4 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = nma_MAE121_spring_2010_lab4_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; function lenTag_Callback(hObject, eventdata, handles) % hObject handle to lenTag (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 lenTag as text % str2double(get(hObject,'String')) returns contents of lenTag as a double % --- Executes during object creation, after setting all properties. function lenTag_CreateFcn(hObject, eventdata, handles) % hObject handle to lenTag (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 abRatioTag_Callback(hObject, eventdata, handles) % hObject handle to abRatioTag (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 abRatioTag as text % str2double(get(hObject,'String')) returns contents of abRatioTag as a double % --- Executes during object creation, after setting all properties. function abRatioTag_CreateFcn(hObject, eventdata, handles) % hObject handle to abRatioTag (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 mTag_Callback(hObject, eventdata, handles) % hObject handle to mTag (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 mTag as text % str2double(get(hObject,'String')) returns contents of mTag as a double % --- Executes during object creation, after setting all properties. function mTag_CreateFcn(hObject, eventdata, handles) % hObject handle to mTag (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 CFTag_Callback(hObject, eventdata, handles) % hObject handle to CFTag (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 CFTag as text % str2double(get(hObject,'String')) returns contents of CFTag as a double % --- Executes during object creation, after setting all properties. function CFTag_CreateFcn(hObject, eventdata, handles) % hObject handle to CFTag (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 kTag_Callback(hObject, eventdata, handles) % hObject handle to kTag (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 kTag as text % str2double(get(hObject,'String')) returns contents of kTag as a double % --- Executes during object creation, after setting all properties. function kTag_CreateFcn(hObject, eventdata, handles) % hObject handle to kTag (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 fTag_Callback(hObject, eventdata, handles) % hObject handle to fTag (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 fTag as text % str2double(get(hObject,'String')) returns contents of fTag as a double % --- Executes during object creation, after setting all properties. function fTag_CreateFcn(hObject, eventdata, handles) % hObject handle to fTag (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 UTag_Callback(hObject, eventdata, handles) % hObject handle to UTag (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 UTag as text % str2double(get(hObject,'String')) returns contents of UTag as a double % --- Executes during object creation, after setting all properties. function UTag_CreateFcn(hObject, eventdata, handles) % hObject handle to UTag (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 deltaZeroTag_Callback(hObject, eventdata, handles) % hObject handle to deltaZeroTag (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 deltaZeroTag as text % str2double(get(hObject,'String')) returns contents of deltaZeroTag as a double % --- Executes during object creation, after setting all properties. function deltaZeroTag_CreateFcn(hObject, eventdata, handles) % hObject handle to deltaZeroTag (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 thetaZeroTag_Callback(hObject, eventdata, handles) % hObject handle to thetaZeroTag (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 thetaZeroTag as text % str2double(get(hObject,'String')) returns contents of thetaZeroTag as a double % --- Executes during object creation, after setting all properties. function thetaZeroTag_CreateFcn(hObject, eventdata, handles) % hObject handle to thetaZeroTag (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 rZeroTag_Callback(hObject, eventdata, handles) % hObject handle to rZeroTag (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 rZeroTag as text % str2double(get(hObject,'String')) returns contents of rZeroTag as a double % --- Executes during object creation, after setting all properties. function rZeroTag_CreateFcn(hObject, eventdata, handles) % hObject handle to rZeroTag (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 vZeroTag_Callback(hObject, eventdata, handles) % hObject handle to vZeroTag (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 vZeroTag as text % str2double(get(hObject,'String')) returns contents of vZeroTag as a double % --- Executes during object creation, after setting all properties. function vZeroTag_CreateFcn(hObject, eventdata, handles) % hObject handle to vZeroTag (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 maxtTag_Callback(hObject, eventdata, handles) % hObject handle to maxtTag (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 maxtTag as text % str2double(get(hObject,'String')) returns contents of maxtTag as a double % --- Executes during object creation, after setting all properties. function maxtTag_CreateFcn(hObject, eventdata, handles) % hObject handle to maxtTag (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 runTag. function runTag_Callback(hObject, eventdata, handles) % hObject handle to runTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) userData = get(handles.figure1, 'UserData'); userData.stop = false; set(handles.figure1, 'UserData',userData); data.L=str2num(get(handles.lenTag,'String')); data.abRatio=str2num(get(handles.abRatioTag,'String')); data.m=str2num(get(handles.mTag,'String')); data.Cf=str2num(get(handles.CFTag,'String')); data.Cf=data.Cf*180/pi; %read as lb/degree, convert to lb/radian data.f=str2num(get(handles.fTag,'String')); data.b= data.L/(1+data.abRatio); data.a= data.L-data.b; data.Ic = data.m*data.a*data.b/2; contents = cellstr(get(handles.criticalMultiplierTag,'String')); data.criticalMultipler=str2num(contents{get(... handles.criticalMultiplierTag,'Value')}); MPH=(60*60)/5280; FTS=1/MPH; if get(handles.underSteerBtn,'Value')==1 data.ku=get(handles.kuStableTag,'Value'); data.U=str2num(get(handles.UTag,'String')); data.U=data.U*FTS; %ft/sec data.Cr = data.ku*(data.a/data.b)*data.Cf; else data.ku=get(handles.unstableKuTag,'Value'); data.Cr = data.ku*(data.a/data.b)*data.Cf; data.Ucrit = sqrt( (data.a+data.b)^2*... (data.Cf*data.Cr)/(data.m*(data.a*data.Cf-data.b*data.Cr))); data.U=data.criticalMultipler*data.Ucrit ; set(handles.calculatedUcritTag,'String', data.Ucrit*MPH); set(handles.calcuatedUTag,'String', data.U*MPH); end data.deltaZero=str2num(get(handles.deltaZeroTag,'String')); data.deltaZero=data.deltaZero*pi/180; data.thetaZero=str2num(get(handles.thetaZeroTag,'String')); data.thetaZero=data.thetaZero*pi/180; data.rZero=str2num(get(handles.rZeroTag,'String')); data.rZero=data.rZero*pi/180; data.vZero=str2num(get(handles.vZeroTag,'String')); data.vZero=data.vZero*FTS; data.maxt=str2num(get(handles.maxtTag,'String')); if data.maxt>150 uiwait(errordlg('simulation time limit is 150 seconds',... 'Bad Input', 'modal')); uicontrol(handles.maxtTag); return end data.handles=handles; enableAll(handles,'off') [g_msg,g_status]=nma_MAE121_spring_2010_lab4Main(data); enableAll(handles,'on'); % --- Executes on button press in stopTag. function stopTag_Callback(hObject, eventdata, handles) % hObject handle to stopTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) userData = get(handles.figure1, 'UserData'); userData.stop = true; set(handles.figure1, 'UserData',userData); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over underSteerBtn. function underSteerBtn_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to underSteerBtn (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) i=1; % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over overSteerBtn. function overSteerBtn_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to overSteerBtn (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) i=1; % --- Executes when selected object is changed in steeringModePanel. function steeringModePanel_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to the selected object in steeringModePanel % eventdata structure with the following fields (see UIBUTTONGROUP) % EventName: string 'SelectionChanged' (read only) % OldValue: handle of the previously selected object or empty if none was selected % NewValue: handle of the currently selected object % handles structure with handles and user data (see GUIDATA) switch get(hObject,'Tag') case 'underSteerBtn' set(handles.unstableKuTag,'Enable','off'); set(handles.criticalMultiplierTag,'Enable','off'); set(handles.unstableKuValueTag,'Enable','off'); set(handles.calculatedUcritTag,'Enable','off'); set(handles.calcuatedUTag,'Enable','off'); set(handles.kuStableTag,'Enable','on'); set(handles.UTag,'Enable','on'); set(handles.stableKuValueTag,'Enable','inactive'); case 'overSteerBtn' set(handles.unstableKuTag,'Enable','inactive'); set(handles.unstableKuValueTag,'Enable','inactive'); set(handles.calculatedUcritTag,'Enable','inactive'); set(handles.calcuatedUTag,'Enable','inactive'); set(handles.unstableKuTag,'Enable','on'); set(handles.criticalMultiplierTag,'Enable','on'); set(handles.kuStableTag,'Enable','off'); set(handles.UTag,'Enable','off'); set(handles.stableKuValueTag,'Enable','off'); end % -------------------------------------------------------------------- function steeringModePanel_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to steeringModePanel (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on selection change in criticalMultiplierTag. function criticalMultiplierTag_Callback(hObject, eventdata, handles) % hObject handle to criticalMultiplierTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns criticalMultiplierTag contents as cell array % contents{get(hObject,'Value')} returns selected item from criticalMultiplierTag contents = cellstr(get(hObject,'String')); criticalMultipler=str2num(contents{get(hObject,'Value')}); updateUnstable(criticalMultipler,handles); % --- Executes during object creation, after setting all properties. function criticalMultiplierTag_CreateFcn(hObject, eventdata, handles) % hObject handle to criticalMultiplierTag (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 % --- Executes on slider movement. function stableKuSliderTag_Callback(hObject, eventdata, handles) % hObject handle to stableKuSliderTag (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider % --- Executes during object creation, after setting all properties. function stableKuSliderTag_CreateFcn(hObject, eventdata, handles) % hObject handle to stableKuSliderTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), ... get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function kuStableTag_Callback(hObject, eventdata, handles) % hObject handle to kuStableTag (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider v=get(hObject,'Value'); set(handles.stableKuValueTag,'String',v); % --- Executes during object creation, after setting all properties. function kuStableTag_CreateFcn(hObject, eventdata, handles) % hObject handle to kuStableTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), ... get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function unstableKuTag_Callback(hObject, eventdata, handles) % hObject handle to unstableKuTag (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider v=get(hObject,'Value'); set(handles.unstableKuValueTag,'String',v); contents = cellstr(get(handles.criticalMultiplierTag,'String')); criticalMultipler=... str2num(contents{get(handles.criticalMultiplierTag,'Value')}); updateUnstable(criticalMultipler,handles); % --- Executes during object creation, after setting all properties. function unstableKuTag_CreateFcn(hObject, eventdata, handles) % hObject handle to unstableKuTag (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), ... get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end function stableKuValueTag_Callback(hObject, eventdata, handles) % hObject handle to stableKuValueTag (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 stableKuValueTag as text % str2double(get(hObject,'String')) returns contents of stableKuValueTag as a double % --- Executes during object creation, after setting all properties. function stableKuValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to stableKuValueTag (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 unstableKuValueTag_Callback(hObject, eventdata, handles) % hObject handle to unstableKuValueTag (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 unstableKuValueTag as text % str2double(get(hObject,'String')) returns contents of unstableKuValueTag as a double % --- Executes during object creation, after setting all properties. function unstableKuValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to unstableKuValueTag (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 calculatedUcritTag_Callback(hObject, eventdata, handles) % hObject handle to calculatedUcritTag (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 calculatedUcritTag as text % str2double(get(hObject,'String')) returns contents of calculatedUcritTag as a double % --- Executes during object creation, after setting all properties. function calculatedUcritTag_CreateFcn(hObject, eventdata, handles) % hObject handle to calculatedUcritTag (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 calcuatedUTag_Callback(hObject, eventdata, handles) % hObject handle to calcuatedUTag (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 calcuatedUTag as text % str2double(get(hObject,'String')) returns contents of calcuatedUTag as a double % --- Executes during object creation, after setting all properties. function calcuatedUTag_CreateFcn(hObject, eventdata, handles) % hObject handle to calcuatedUTag (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 updateUnstable(criticalMultipler,handles) MPH=(60*60)/5280; FTS=1/MPH; L = str2num(get(handles.lenTag,'String')); abRatio = str2num(get(handles.abRatioTag,'String')); m = str2num(get(handles.mTag,'String')); Cf = str2num(get(handles.CFTag,'String')); Cf = Cf*180/pi; b = L/(1+abRatio); a = L-b; ku = get(handles.unstableKuTag,'Value'); Cr = ku*(a/b)*Cf; Ucrit = sqrt( (a+b)^2*(Cf*Cr)/(m*(a*Cf-b*Cr))); U = criticalMultipler*Ucrit ; set(handles.calculatedUcritTag,'String',Ucrit*MPH); set(handles.calcuatedUTag,'String', U*MPH); function timeValueTag_Callback(hObject, eventdata, handles) % hObject handle to timeValueTag (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 timeValueTag as text % str2double(get(hObject,'String')) returns contents of timeValueTag as a double % --- Executes during object creation, after setting all properties. function timeValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to timeValueTag (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 speedValueTag_Callback(hObject, eventdata, handles) % hObject handle to speedValueTag (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 speedValueTag as text % str2double(get(hObject,'String')) returns contents of speedValueTag as a double % --- Executes during object creation, after setting all properties. function speedValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to speedValueTag (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 yawRateValueTag_Callback(hObject, eventdata, handles) % hObject handle to yawRateValueTag (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 yawRateValueTag as text % str2double(get(hObject,'String')) returns contents of yawRateValueTag as a double % --- Executes during object creation, after setting all properties. function yawRateValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to yawRateValueTag (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 YfValueTag_Callback(hObject, eventdata, handles) % hObject handle to YfValueTag (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 YfValueTag as text % str2double(get(hObject,'String')) returns contents of YfValueTag as a double % --- Executes during object creation, after setting all properties. function YfValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to YfValueTag (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 YrValueTag_Callback(hObject, eventdata, handles) % hObject handle to YrValueTag (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 YrValueTag as text % str2double(get(hObject,'String')) returns contents of YrValueTag as a double % --- Executes during object creation, after setting all properties. function YrValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to YrValueTag (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 thetaValueTag_Callback(hObject, eventdata, handles) % hObject handle to thetaValueTag (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 thetaValueTag as text % str2double(get(hObject,'String')) returns contents of thetaValueTag as a double % --- Executes during object creation, after setting all properties. function thetaValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to thetaValueTag (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 CfValueTag_Callback(hObject, eventdata, handles) % hObject handle to CfValueTag (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 CfValueTag as text % str2double(get(hObject,'String')) returns contents of CfValueTag as a double % --- Executes during object creation, after setting all properties. function CfValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to CfValueTag (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 CrValueTag_Callback(hObject, eventdata, handles) % hObject handle to CrValueTag (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 CrValueTag as text % str2double(get(hObject,'String')) returns contents of CrValueTag as a double % --- Executes during object creation, after setting all properties. function CrValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to CrValueTag (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 steerAngleValueTag_Callback(hObject, eventdata, handles) % hObject handle to steerAngleValueTag (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 steerAngleValueTag as text % str2double(get(hObject,'String')) returns contents of steerAngleValueTag as a double % --- Executes during object creation, after setting all properties. function steerAngleValueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to steerAngleValueTag (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 alpha_r_valueTag_Callback(hObject, eventdata, handles) % hObject handle to alpha_r_valueTag (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 alpha_r_valueTag as text % str2double(get(hObject,'String')) returns contents of alpha_r_valueTag as a double % --- Executes during object creation, after setting all properties. function alpha_r_valueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to alpha_r_valueTag (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 alpha_f_valueTag_Callback(hObject, eventdata, handles) % hObject handle to alpha_f_valueTag (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 alpha_f_valueTag as text % str2double(get(hObject,'String')) returns contents of alpha_f_valueTag as a double % --- Executes during object creation, after setting all properties. function alpha_f_valueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to alpha_f_valueTag (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 V_valueTag_Callback(hObject, eventdata, handles) % hObject handle to V_valueTag (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 V_valueTag as text % str2double(get(hObject,'String')) returns contents of V_valueTag as a double % --- Executes during object creation, after setting all properties. function V_valueTag_CreateFcn(hObject, eventdata, handles) % hObject handle to V_valueTag (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 enableAll(handles,to) set(handles.lenTag,'Enable',to); set(handles.abRatioTag,'Enable',to); set(handles.mTag,'Enable',to); set(handles.CFTag,'Enable',to); set(handles.fTag,'Enable',to); set(handles.deltaZeroTag,'Enable',to); set(handles.thetaZeroTag,'Enable',to); set(handles.rZeroTag,'Enable',to); set(handles.vZeroTag,'Enable',to); set(handles.maxtTag,'Enable',to); set(handles.underSteerBtn,'Enable',to); if strcmp(to,'on') if get(handles.underSteerBtn,'Value')==1 set(handles.kuStableTag,'Enable',to); set(handles.UTag,'Enable',to); set(handles.stableKuValueTag,'Enable','inactive'); end else set(handles.kuStableTag,'Enable',to); set(handles.UTag,'Enable',to); set(handles.stableKuValueTag,'Enable','off'); end set(handles.overSteerBtn,'Enable',to); if strcmp(to,'on') if get(handles.overSteerBtn,'Value')==1 set(handles.unstableKuTag,'Enable',to); set(handles.criticalMultiplierTag,'Enable',to); set(handles.unstableKuValueTag,'Enable','inactive'); set(handles.calculatedUcritTag,'Enable','inactive'); set(handles.calcuatedUTag,'Enable','inactive'); end else set(handles.unstableKuTag,'Enable',to); set(handles.criticalMultiplierTag,'Enable',to); set(handles.unstableKuValueTag,'Enable',to); set(handles.calculatedUcritTag,'Enable',to); set(handles.calcuatedUTag,'Enable',to); end set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.lenTag,'Enable',to); set(handles.linearModelBtn,'Enable',to); set(handles.nonlinearModelBtn,'Enable',to); function nma_set_figure_position(the_handle,x,y,w,h) %utility function, called to create a figure %in middle of window % %by Nasser M. Abbasi % sz = get(0,'ScreenSize'); wid = sz(3); hight = sz(4); set(the_handle,'Units','pixels'); set(the_handle,'Position',[x*wid y*hight w*wid h*hight]);