How can I plot cornering stiffness using GUI ?

Hello Everyone
I am Koushik, a young automotive engineering graduate with keen interest in vehicle dynamics.I have just started learning MATLAB on my own.I wanted to create a plot for Cornering stiffness of a Tyre ( Lateral Force Vs Slip Angle).So,I created a GUI and I am struggling to plot the graph.I have attached the .m file and the .fig file for your reference.Kindly guide me on plotting this.

답변 (1개)

Adam
Adam 2015년 5월 27일

0 개 추천

You can use e.g.
handles.Fz = str2double(get(hObject,'String'));
in your callback (e.g. the Fz0_Callback)
then in your plot callback use
handles.Fz
instead of just variables that don't exist in the scope of the plot function.
Or in the plot function you can get the values directly from the ui controls using the same manner, but without needing to save them on the handle struct.

댓글 수: 2

Turboduff
Turboduff 2015년 6월 2일
편집: Turboduff 2015년 6월 2일
Hi Adam
First of all thank you very much for your answer and Sorry for the late response.I tried it, but still it shows an error.
I guess I messed up somewhere.I have attached the updated .m file for your reference.
In the calculation process there comes point, where the MATLAB takes a decision based on the value of alphay .
If alphay is positive then sgn(alphay) should take the value 1 else it must take the value -1.
I get an error here like this
" Attempted to access sign(40634.4); index must be a positive integer or logical.
Error in cornering_stiffness_plot>plot_Callback (line 642) sign(alphay)= 1;
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in cornering_stiffness_plot (line 43) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)cornering_stiffness_plot('plot_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback* "
Looking forward for your response.
Regards Koushik
There are a few things wrong with this piece of code:
if alphay>0
sign(alphay)= 1;
else
sign(alphay)= -1;
  1. You are using alphay as an array index despite it not being an integer (as the error says).
  2. You are overwriting (or hiding, rather) a builtin function by assigning to an array called 'sign'.
  3. The builtin function that you are overwriting would give exactly the answer you want if you were to simply call it where needed rather than trying to re-implement it yourself by assigning values to an array.
If you were to just remove the above lines of code then the call to sign(alphay) on the subsequent line should work fine by calling the builtin function rather than an array you are trying to create to hide the function.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품

질문:

2015년 5월 27일

댓글:

2015년 6월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by