I'm getting the error "terminate statement with semicolon to suppress output" but I haven't used any functions.

조회 수: 2 (최근 30일)
The code was previously displaying the graphs properly but it stopped displaying that too all of a sudden. It also shows the error "terminate statement with semicolon to suppress output".
% GIVEN DATA:
v=400; %Rated voltage
p=250000; %Power
pole=4;
rs=0.032;
rr=0.02;
ls=0.0003183;
lr=0.00047428;
lm=0.0174;
f=50; %frequency
% TORQUE SLIP CHARACTERISTICS
hold on
wms=(4.*pi.*f)./pole
xnet=2.*pi.*f.*(ls+lr)
z = sqrt( (rs+(rr./x)).^2 + (xnet.^2))
y = 3 .* (v./z).^2 .* rr ./ (x.*wms) %k=1
xlim([0 1])
plot(x,y)
wms=(4.*pi.*f)./pole
xnet=2.*pi.*f.*(ls+lr)
z = sqrt( (rs+(rr./x)).^2 + 25.*(xnet.^2))
y = -3 .* (v./z).^2 .* rr ./ (x.*wms.*25) %k=5
plot(x,y)
wms=(4.*pi.*f)./pole
xnet=2.*pi.*f.*(ls+lr)
z = sqrt( (rs+(rr./x)).^2 + 49.*(xnet.^2))
y = 3 .* (v./z).^2 .* rr ./ (x.*wms.*49) %k=7
yyaxis right
plot(x,y)
hold off
% SPEED TORQUE CHARATCERISTICS
figure(2)
hold on
wms=(4.*pi.*f)./pole
xnet=2.*pi.*f.*(ls+lr)
s = (wms - x) ./ wms
z = sqrt( (rs+(rr./s)).^2 + (xnet.^2))
y = 3 .* (v./z).^2 .* rr ./ (s.*wms) %k=1
ylim([0 10000])
xlim([0 20])
plot(x,y)
hold off
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 4월 25일
Did you happen to switch from using LiveScript to using a regular script ?
Adam Danz
Adam Danz 2019년 4월 25일
편집: Adam Danz 2019년 4월 25일
I updated my answer to address the empty plots. You haven't provided a value for 'x' as Rik pointed out. When I used
x = 0 : 0.01: 5;
your plots produces lines.
I haven't looked into the code any further.

댓글을 달려면 로그인하십시오.

답변 (2개)

Ivan Gonzalez Bustos
Ivan Gonzalez Bustos 2020년 2월 27일

Adam Danz
Adam Danz 2019년 4월 25일
편집: Adam Danz 2019년 4월 25일
Your sample code does not provide a value for x. When x is a vector (x = 0 : .01 : 5), your plot produce lines.
As for the semicolon warning, there are lots of lines in your code that do not end with ";" and many of those lines produce outputs to your command window. This is typically sloppy which is why Matlab is warning you. To fix it, just add the semicolon (;) to the end of those lines.
% GIVEN DATA:
v=400; %Rated voltage
p=250000; %Power
pole=4;
rs=0.032;
rr=0.02;
ls=0.0003183;
lr=0.00047428;
lm=0.0174;
f=50; %frequency
% TORQUE SLIP CHARACTERISTICS
hold on
wms=(4.*pi.*f)./pole % <--HERE
xnet=2.*pi.*f.*(ls+lr) % <--HERE
z = sqrt( (rs+(rr./x)).^2 + (xnet.^2)) % <--HERE
y = 3 .* (v./z).^2 .* rr ./ (x.*wms) %k=1 % <--HERE
xlim([0 1])
plot(x,y)
wms=(4.*pi.*f)./pole % <--HERE
xnet=2.*pi.*f.*(ls+lr) % <--HERE
z = sqrt( (rs+(rr./x)).^2 + 25.*(xnet.^2)) % <--HERE
y = -3 .* (v./z).^2 .* rr ./ (x.*wms.*25) %k=5 % <--HERE
plot(x,y)
wms=(4.*pi.*f)./pole % <--HERE
xnet=2.*pi.*f.*(ls+lr) % <--HERE
z = sqrt( (rs+(rr./x)).^2 + 49.*(xnet.^2)) % <--HERE
y = 3 .* (v./z).^2 .* rr ./ (x.*wms.*49) %k=7 % <--HERE
% You get the picture......

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by