필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why is this code returning a blank plot?

조회 수: 1 (최근 30일)
Lakerpurp24
Lakerpurp24 2019년 10월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
v = 240
i = 4.17
z = v/i
pf = -1
for count = 1:1:20
r = z * (pf)
x = z * sin(acos(pf))
voltage_reg(count) = ((i * ((r * cos(pf)) + (x * sin(pf))))/v) * 100
pf = pf+.1
end
plot(pf,voltage_reg)

답변 (1개)

Manuel Salmerón
Manuel Salmerón 2019년 10월 1일
The variable pf is a scalar. Probably you wanted to store it into a vector instead.
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 10월 1일
Right. At the point of the plot() call, pf is a scalar that stores the last value that was assigned due to the pf = pf+.1 statement. That is, you should note, a value that was never used for computation, because you increment it after you compute with it the last time.
I recommend that you read

이 질문은 마감되었습니다.

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by