Info

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

What is wrong with my code?

조회 수: 1 (최근 30일)
KMA
KMA 2018년 5월 3일
마감: MATLAB Answer Bot 2021년 8월 20일
I've included a picture of my prompt. This is what I have so far and I don't understand why it doesn't work. Any tips or guidance is appreciated!
n=1;
while (pi_val<=.000000001)
syms n
pi_val=sqrt(6*symsum(1/n^2, n, 1, Inf))
end

답변 (1개)

Siyu Guo
Siyu Guo 2018년 5월 3일
You try to read the variable "pi_val" before you have initialized it by a write operation. This is an error, at least for MATLAB 2012 or lower. Besides, I cannot see any reason for the use of this loop.

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

Community Treasure Hunt

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

Start Hunting!

Translated by