how to plot a function?

조회 수: 1 (최근 30일)
Kit Coltamne
Kit Coltamne 2017년 11월 30일
댓글: Star Strider 2017년 11월 30일
Im trying to plot 'd' as a function of variable 'me' from 0 to 1200 but just get a straight line. Any suggestions? Thanks.
mc = 1000;
Sp = 4000;
Se = 400000;
Sc = 0.2;
eff = 0.6;
v = 13.41;
me = 0:1200;
d = ((Se*me*(Sp-(Sc*v)))/(Sc*Sp*(mc+me)))*eff;
plot(me,d,'x')

채택된 답변

Star Strider
Star Strider 2017년 11월 30일
You need to vectorise the division (use (./) instead of (/):
d = ((Se*me*(Sp-(Sc*v)))./(Sc*Sp*(mc+me)))*eff;
INSERT ‘.’ HERE
See Array vs. Matrix Operations (link) for details.
  댓글 수: 2
Kit Coltamne
Kit Coltamne 2017년 11월 30일
Perfect, thank you !!
Star Strider
Star Strider 2017년 11월 30일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by