Hey :)
When I execute this code, the interpreter complains about y in the complex number c. I'm stuck :( Does anybody know the answer?
function m = mandelbrot(x,y)
nMax = 1000;
n=0;
z = 0;
c = x+i*y;
for n = [0:nMax]
z = z**2 + c ;
endfor
if abs(z)>2
m=1;
else
m=0;
endif
end

 채택된 답변

Mischa Kim
Mischa Kim 2014년 1월 16일
편집: Mischa Kim 2014년 1월 16일

0 개 추천

I would assume it's the z**2 (the double star) that's causing the problem. What are you trying to do there? There's a couple of other issues ( endfor , e.g.)...

추가 답변 (1개)

Martial
Martial 2014년 1월 16일

0 개 추천

Thank you Mischa :) It's an alternative way for writing x^2 in Octave.

댓글 수: 1

Mischa Kim
Mischa Kim 2014년 1월 16일
That's what I thought. Welcome to MATLAB, Martial.

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

카테고리

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

질문:

2014년 1월 16일

댓글:

2014년 1월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by