Hello,
Here is my code:
x = -5:0.05:10;
y=log(x);
plot(x,y)
comet(x,y)
It won't let it animate. When i put x = 1:0.05:10; it does animate , but shouldn't matlab do it anyway? Why doesn't it animate from 1 to 10 even if i put -5 , every other function works fine? Maybe comet doesn't work with it?
If you have any ideas, please help.

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 11월 17일
편집: Cris LaPierre 2020년 11월 17일

0 개 추천

Perhaps reading the error message you get on the screen will help explain the issue:
Warning: Imaginary parts of complex X and/or Y arguments ignored.
Error using matlab.graphics.axis.Axes/set
Complex values are not supported.
When you take the log of numbers <0, you result is complex. Numbers >0 are not. Comet does not support complex numbers. Consider instead using the magnitude: comet(x,abs(y)) or the real part: comet(x,real(y))

추가 답변 (1개)

VBBV
VBBV 2020년 11월 17일
편집: VBBV 2020년 11월 17일

2 개 추천

%f true
comet(x,real(y))
Use the real components to graph.

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

질문:

2020년 11월 17일

편집:

2020년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by