www.gusucode.com > Chapter_9 > Chapter_9/Chapter_9/Section_7/Chapter_9_Section_7_Script.m
%Book Title: Practical Design and Application of MPC %Chapter: 9 %Section: 7 %Authors: Nassim Khaled and Bibin Pattel %Last Modified: 10/07/2017 %% close all fig=figure; hax=axes; hold on input_pwm_steady_state_points = [25.5 50.1 76.5 102 127.5 153 178.5 204 229.5 255]; output_motor_speed_points = [78.1 185.9 260.2 305.1 331.5 351 363.3 374.1 382.7 394.4]; plot(input_pwm_steady_state_points,output_motor_speed_points,'linewidth',2,'Marker','diamond'); line([76.5 76.5],get(hax,'YLim'),'Color',[1 0 0],'linewidth',2) line([153 153],get(hax,'YLim'),'Color',[0 1 0],'linewidth',2) line([255 255],get(hax,'YLim'),'Color',[0 0 1],'linewidth',2) grid on xlabel('PWM Input Value Steady State Points'); ylabel('Motor Speed Output Steady State Points') set(gcf,'color',[1 1 1]); title('Non-Linearity Analysis of the Motor Based on Input Vs Output') annotation(fig,'textbox',... [0.1635 0.577991452991452 0.0948333333333331 0.0512820512820514],... 'String',{'Linear Region #1'},... 'LineWidth',2,... 'FitBoxToText','off'); annotation(fig,'textbox',... [0.389802083333333 0.579594017094016 0.0948333333333332 0.0512820512820514],... 'String',{'Linear Region #2'},... 'LineWidth',2,... 'FitBoxToText','off'); annotation(fig,'textbox',... [0.649697916666666 0.582799145299144 0.0948333333333332 0.0512820512820514],... 'String',{'Linear Region #3'},... 'LineWidth',2,... 'FitBoxToText','off');