how do i get this to plot a graph

1 次查看(过去 30 天)
close all
T= 1;
P = 4;
rs = 3.4;
lamda = 0.2;
Lss = .0011+(3/2)*.011;
rpm = 0;
wr = (P/2)*(2*pi*(rpm/60));
x = (lamda*rs)/((rs*rs)+(wr*wr)*(Lss*Lss));
new_VS = ((T*4/(x*3*P))+(wr*lamda))/sqrt(2);
total_vdc = 0;
N = 600 ;
while (rpm < N)
wr = (P/2)*(2*pi*(rpm/60));
x = (lamda*rs)/((rs*rs)+(wr*wr)*(Lss*Lss));
new_VS = ((T*4/(x*3*P))+(wr*lamda))/sqrt(2);
total_vdc = sqrt(2)*new_VS*2;
rpm = rpm + 1;
hold on
plot(rpm,total_vdc)
end
I can not seem to get this to plot. I only get blank graph. What am I doing wrong? Thank you in advance

采纳的回答

David Fletcher
David Fletcher 2021-4-12
编辑:David Fletcher 2021-4-12
You are trying to plot isolated unconnected points - they can't be joined with a line so the only way you can see them is to use a marker
plot(rpm,total_vdc,'+')
This will give you a graph (of sorts), but I doubt it is what you want.
Try this:
T= 1;
P = 4;
rs = 3.4;
lamda = 0.2;
Lss = .0011+(3/2)*.011;
rpm = 0;
wr = (P/2)*(2*pi*(rpm/60));
x = (lamda*rs)/((rs*rs)+(wr*wr)*(Lss*Lss));
new_VS = ((T*4/(x*3*P))+(wr*lamda))/sqrt(2);
total_vdc = 0;
N = 600 ;
iter=1;
while (rpm < N)
wr = (P/2)*(2*pi*(rpm/60));
x = (lamda*rs)/((rs*rs)+(wr*wr)*(Lss*Lss));
new_VS = ((T*4/(x*3*P))+(wr*lamda))/sqrt(2);
total_vdc(iter) = sqrt(2)*new_VS*2;
Y(iter) = rpm;
iter=iter+1;
rpm = rpm + 1;
end
plot(Y,total_vdc)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by