why is my plot not working

조회 수: 1 (최근 30일)
Colby Jennings
Colby Jennings 2021년 4월 15일
댓글: Colby Jennings 2021년 4월 15일
I have copied the format of plot code directly, but it doesnt like my equation. I have tried everything I know please help, im dying.

채택된 답변

David Hill
David Hill 2021년 4월 15일
t=1:10;
F=1./(4.^t)-1./(5.^t);
plot(t,F);
  댓글 수: 2
Daniel Pollard
Daniel Pollard 2021년 4월 15일
This works because of the . used before each operation. In your code, you tried
1/4^x
which the matlab code interprets as you trying to raise a number (4) to the power of a vector, x. That doesn't really work in normal mathematics, and MATLAB would have thrown an error.
David's code instead writes
1/4.^x
which MATLAB reads to mean "for each element xi in x, calculate 1/4^xi". This is what you intended and is the usual way of calculating values for plotting.
Colby Jennings
Colby Jennings 2021년 4월 15일
oh okay. thankyou

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by