Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. function pushbutton1_Callback(hObject, eventdata, handles)
  2. % hObject handle to pushbutton1 (see GCBO)
  3. % eventdata reserved - to be defined in a future version of MATLAB
  4. % handles structure with handles and user data (see GUIDATA)
  5. a=str2double(get(handles.editA,'String'));
  6. b=str2double(get(handles.editB,'String'));
  7. h=(b-a)/100;
  8. t=a:h:b;
  9.  
  10. if get(handles.rbs,'Value') == 1
  11. plot(t, sin(t));
  12. elseif get(handles.rbc,'Value') == 1
  13. plot(t, cos(t));
  14. elseif get(handles.rbt,'Value') == 1
  15. plot(t, tan(t));
  16. elseif get(handles.rbsh,'Value') == 1
  17. plot(t, sinh(t));
  18. elseif get(handles.rbch,'Value') == 1
  19. plot(t, cosh(t));
  20. elseif get(handles.rbth,'Value') == 1
  21. plot(t, tanh(t));
  22. elseif get(handles.rbe,'Value') == 1
  23. plot(t, exp(t));
  24. elseif get(handles.rbln,'Value') == 1
  25. plot(t, log(t));
  26. end
  27.  
  28. if get(handles.checkbox_x,'Value' )==1
  29. set(gca,'XGrid','on' );
  30. else
  31. set(gca,'XGrid','off' );
  32. end
  33. if get(handles.checkbox_y,'Value' )==1
  34. set(gca,'YGrid','on' );
  35. else
  36. set(gca,'YGrid','off');
  37. end
  38.  
  39.  
  40. % --- Executes on button press in checkbox_x.
  41. function checkbox_x_Callback(hObject, eventdata, handles)
  42. % hObject handle to checkbox_x (see GCBO)
  43. % eventdata reserved - to be defined in a future version of MATLAB
  44. % handles structure with handles and user data (see GUIDATA)
  45. if get(hObject, 'Value') == 1
  46. set(gca, 'XGrid', 'on');
  47. else
  48. set(gca, 'XGrid', 'off');
  49. end
  50.  
  51. % --- Executes on button press in checkbox_y.
  52. function checkbox_y_Callback(hObject, eventdata, handles)
  53. % hObject handle to checkbox_y (see GCBO)
  54. % eventdata reserved - to be defined in a future version of MATLAB
  55. % handles structure with handles and user data (see GUIDATA)
  56. if get(hObject, 'Value') == 1
  57. set(gca, 'YGrid', 'on');
  58. else
  59. set(gca, 'YGrid', 'off');
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement