Clear Filters
Clear Filters

Error using plot: Unrecognized property LineWidth for class Line

131 views (last 30 days)
Hello everyone.
I am trying to excecute a code found in the book "Mechatronics and Control of Electromechanical Systems" by Sergey Edward Lyshevski.
The code is in the page 212 and when I write it come the next error: "Error using plot: Unrecognized property LineWidth for class Line"
How can I solve the error?
I appreciate your help!
Here is the code:
th=0:0.01:4*pi;% angular rotor displacement
IM=10; P=4; LDm=0.05; phi=0.3245;
% Balanced three-phase current set
Ias=sqrt(2)*IM*sin(th+phi*pi/3); Ibs=sqrt(2)*IM*sin(th-(2-phi)*pi/3);
Ics=sqrt(2)*IM*sin(th+(2+phi)*pi/3);
% Calculation of the electromagnetic torque
Te=P*LDm*(Ias.*(sin(2*th).*Ias+2*sin(2*th-2*pi/3).*Ibs+2*sin(2*th+2*pi/3).*Ics)+Ibs.*(sin(2*th-4*pi/3).*Ibs+2*sin(2*th).*Ics)+Ics.*sin(2*th+4*pi/3).*Ics)/2;
% Plot the currents applied to the abc windings
plot(th,Ias, 'k− ',th,Ibs, 'b−− ',th,Ics, 'r: ','LineWidth ',2.5); axis([0,4*pi,-15,15]);
xlabel('Angular Displacement, \theta_r [rad] ', 'FontSize ',18);
title('Phase Currents, {\iti_a_s}, {\iti_b_s} and {\iti_c_s} [A] ', 'FontSize ',18); pause;
% Plot of the torque developed versus the angular displacement
plot(th,Te, 'k− ','LineWidth ',2.5); axis([0,4*pi,0,30]);
xlabel('Angular Displacement, \theta_r [rad] ', 'FontSize ',18);
title('Electromagnetic Torque, {\itT_e} [N-m] ', 'FontSize ',18);

Accepted Answer

Voss
Voss on 15 Dec 2022
Edited: Voss on 15 Dec 2022
Use 'LineWidth' instead of 'LineWidth ' with a space on the end.
plot(th,Ias, 'k− ',th,Ibs, 'b−− ',th,Ics, 'r: ','LineWidth ',2.5); axis([0,4*pi,-15,15]);
% ^ this space should be removed
  3 Comments
Ramon Gomez
Ramon Gomez on 15 Dec 2022
Thank you very much, it already worked.
I copied the code from the book and it made automatically the spaces

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!