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;

 채택된 답변

KSSV
KSSV 2017년 4월 13일

0 개 추천

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

댓글 수: 4

Thanks for your help. But now i got this.
Undefined function or variable 'P'.
Error in quodtest (line 19)
maxW = k * (kv * V).^3 * D.^4 * P;
19 maxW = k * (kv * V).^3 * D.^4 * P;
i tried declaring P = 0; and plotting the graph, but then i dont get a graph, its a blank white screen.
You mut know your formulation. If P is a scalar...use only
plot(maxW)
Steven Lord
Steven Lord 2017년 4월 13일
"i tried declaring P = 0; and plotting the graph, but then i dont get a graph, its a blank white screen."
No, you receive a graph. But look at what you're plotting. You're multiplying P by a bunch of other stuff. When P is 0, you're computing 0 times something. What is 0 times just about anything?
Yemal Bandara
Yemal Bandara 2017년 4월 14일
ohhh.. right right.. i think i might have got it now.. thanks a lot :D

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

질문:

2017년 4월 13일

댓글:

2017년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by