what is the error with that code?

2 ビュー (過去 30 日間)
mohamed asran
mohamed asran 2020 年 11 月 9 日
編集済み: Setsuna Yuuki. 2020 年 11 月 9 日
clc
clear all
r=0.05;
l=0.01;
st=0.0001;
v=220;
Kf=18;
j=3;
Tl=60;
i=0;
w=0;
I=[];
W=[];
t=[];
for dt=0:0.0001:1
I=[I i];
t=[t dt];
W=[W w];
i=i+(((v-r*i)-(Kf*w)/l)*st);
w=w+((((Kf*i)-Tl)/j)*st);
end
plot(t,W,'linewidth',4)
xlabel('time (sec)','fontsize','18','fontweight','b');
ylabel('SPEED (rpm)','fontsize','22','fontweight','b');
title('Dynamic model of separately excited dc motor under constant excitation');
axis([0 0.1 0.5])
gri;d
plot(t,I,'linewidth',4)
xlabel('time (sec)','fontsize','18','fontweight','b');
ylabel('current (A)','fontsize','22','fontweight','b');
title('current response of rl circuit');
axis([0 0.1 0.5])

採用された回答

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 9 日
編集済み: Setsuna Yuuki. 2020 年 11 月 9 日
clc
clear all
r=0.05;
l=0.01;
st=0.0001;
v=220;
Kf=18;
j=3;
Tl=60;
i=0;
w=0;
I=[];
W=[];
t=[];
for dt=0:0.0001:1
I=[I i];
t=[t dt];
W=[W w];
i=i+(((v-r*i)-(Kf*w)/l)*st);
w=w+((((Kf*i)-Tl)/j)*st);
end
plot(t,W,'linewidth',4); hold on;
xlabel('time (sec)','fontsize',18,'fontweight','b'); %%Number without ('')
ylabel('SPEED (rpm)','fontsize',22,'fontweight','b');%%Number without ('')
title('Dynamic model of separately excited dc motor under constant excitation');
axis([0 0.5 0 0.5]) %% One limit more
grid on; %%(gri;d)
plot(t,I,'linewidth',4)
xlabel('time (sec)','fontsize',18,'fontweight','b'); %%Number without ('')
ylabel('current (A)','fontsize',22,'fontweight','b'); %%Number without ('')
title('current response of rl circuit');
axis([0 0.5 0 0.5]) %% One limit more

その他の回答 (1 件)

Dennis
Dennis 2020 年 11 月 9 日
You need to pass the FontSize as number and not as string:
xlabel('time (sec)','fontsize',18,'fontweight','b');
^
You need to do this in the other 3 lines aswell.
Also use grid; instead of gri;d

カテゴリ

Help Center および File ExchangeMotor Drives についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by