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

5 次查看(过去 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 个评论
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

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