MATLAB: Getting an error when plotting a graph

graphMATLABplotplotting

maxW = k * (kv * V)^3 * D^4 * P
I want to plot a graph with P on the y axis and D on the x axis. with x going from 0 to 20 at 0.01 intervals. Can i please know how to do it as the plot function doesnt allow me to do this. I tried this
%Battery
S = 3;
mAH = 4000;
AH = mAH/1000;
C = 40;
V = 11.1;
%motor
kv = 920;
%propellor
k = 5.3 * 10^(-15);
%equations
I = C * AH;
maxW = V * I;
D = (0:0.01:20);
maxW = k * (kv * V)^3 * D^4 * P;
plot(D,P), axis equal;
But it gives an error as;
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
Error in quodtest (line 19)
maxW = k * (kv * V)^3 * D^4 * P;
19 maxW = k * (kv * V)^3 * D^4 * P;

Best Answer

Replace
maxW = k * (kv * V)^3 * D^4 * P;
with
maxW = k * (kv * V).^3 * D.^4 * P;