Figure does not display graph
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
KSSV
on 27 Oct 2020
Edited: KSSV
on 27 Oct 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!