필터 지우기
필터 지우기

Figure does not display graph

조회 수: 4 (최근 30일)
Tb
Tb 2020년 10월 27일
댓글: KSSV 2020년 10월 27일
Hello,
I am trying plot a graph of power out over power in (efficiency) for a motor, and I am sure that my equations are correct however, the resulting figure is empty. I tried to bug fix and got rid of the semi-colon after the line of code and found that the was only getting a single value for the variable (0.2423, which sounds about right), I don't understand how MATLAB has computed this value as P_out and P_in are both functions of the torque, and hence the resulting must also be a function of the torque. I am certain that my equations for power out and power in are correct, I think that there is an issue when matlab divides a quadratic function by a linear function. Below is my code:
v = 24; %voltage = 24 V
r = 0.7; %resistance = 0.7 ohms
j = 7.95e-5; %inertia of the rotor = 7.95e-5 kgm^2
k = 0.059; %motor constant = 0.059 Vs/rad
b = 6.65e-5; %damping coefficient = Nms/rad
l = 9.8e-4; %inductance = 9.8e-4 H
i = 0.4494; %steady state current = 0.4494 A
w = 400; %steady state angular velocity = 400 rad/s
T_l = 0; %Torque applied to the motor = 0;
time_period = 0.0014; %time period of the circuit = 0.0014 s
torque = 0:0.01:2.03;
torque_E = -5:0.1:5;
W = (v*k-torque*r)/(r*b+k^2); %angular velocity of the rotor as a function of the torque
I = (b/k)*W +torque/k; %current through motor as a function of the torque
P_out = torque.*W; %power output by the motor
P_in = v*I; %power into the motor
E = (P_out/P_in)
figure
plot(torque, W, 'blue') %angular velocity plot against torque
ylim([0 400]);
x0 = interp1(W,torque,0); % stall torque for motor 1 (x-intercept of the torque axis) = 2.0229.
figure
plot(torque, I, 'red') %current plot against torque
figure
plot(torque, P_out, 'magenta'); %power out plot against torque
ylim([0 250]);
figure
plot(torque, E, 'green'); %effecincy against torque

채택된 답변

KSSV
KSSV 2020년 10월 27일
편집: KSSV 2020년 10월 27일
Replace the lines:
plot(x,y,'red')
with
plot(x,y,'color','red')
Make these changes:
plot(torque, W,'color', 'blue') %angulaof r velocity plot against torque
ylim([0 400]);
x0 = interp1(W,torque,0); % stall torque for motor 1 (x-intercept of the torque axis) = 2.0229.
figure
plot(torque, I,'color', 'red') %current plot against torque
figure
plot(torque, P_out, 'color','magenta'); %power out plot against torque
ylim([0 250]);
figure
plot(torque, E, 'color','green'); %effecincy against torque
Read about the documentation of plot.
  댓글 수: 4
Tb
Tb 2020년 10월 27일
Ah yes, that sorts the issue out, I was aware of .* but wasn't aware of ./ thank you for the help.
KSSV
KSSV 2020년 10월 27일
Thanks is accepting the answer .. :)

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by