The function printArray doesn't exist?

#1

Hi,
I don’t manage to see an array of float.
I don’t understand why. The array is declared like that before the setup

public float[] naturalFrequency;

and I use

printArray (naturalFrequency[i]);

but it doesn’t work

I put the program below

private void solveRK4() {
		calculateOrder();
		for (int i = 0; i < networkSize; i++) {
			float noise = parent.noise(time);
			float k1 = stepSize*differentiate(phase[i], noise, naturalFrequency[i]);
			float k2 = stepSize*differentiate(phase[i] + k1/2, noise, naturalFrequency[i]);
			float k3 = stepSize*differentiate(phase[i] + k2/2, noise, naturalFrequency[i]);
			float k4 = stepSize*differentiate(phase[i] + k3, noise, naturalFrequency[i]);
			phase[i] = (phase[i] + (k1 + 2*k2 + 2*k3 + k4)/6) % TWO_PI;

  printArray (naturalFrequency[i]); 
		}

		
		time += stepSize;
	}

Thanks a lot

1 Like
#2

is not a array, just one element so it can not work.
try:

printArray(naturalFrequency);

or not use it at all,
just

println(naturalFrequency);
//OR
println(naturalFrequency[i]);

depends on the format in the console you want see

2 Likes
#3

Thanks u it works.
How can I make a heart to answer?
I don’t find the heart button.

1 Like
#4

Click on the heart immediately below the post, next to the link, …, and Reply.

43%20AM