Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

What is wrong with my code?

1 visualización (últimos 30 días)
KMA
KMA el 3 de Mayo de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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

Respuestas (1)

Siyu Guo
Siyu Guo el 3 de Mayo de 2018
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.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by