Effacer les filtres
Effacer les filtres

Error using plot: Unrecognized property LineWidth for class Line

126 vues (au cours des 30 derniers jours)
Ramon Gomez
Ramon Gomez le 15 Déc 2022
Commenté : Voss le 15 Déc 2022
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);

Réponse acceptée

Voss
Voss le 15 Déc 2022
Modifié(e) : Voss le 15 Déc 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 commentaires
Ramon Gomez
Ramon Gomez le 15 Déc 2022
Thank you very much, it already worked.
I copied the code from the book and it made automatically the spaces
Voss
Voss le 15 Déc 2022
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by