Serial monitor problem (not showing the result)

Hi! I am beginner of Arduino.
So, I hope you help me a my problem.

I have a problem in serial monitor.
Even though I used Serial.println to show the character and Print() to print the matrix, there is no information in serial monitor.

Below is my code.
I just wrote the code for representing the matrix.
In the Arduino Due, serial monitor showed the value of matrix (whatever matrix in the below code).
But not working in the Arduino Uno.
If I delete the one or two matrix (for example, ut, temp1), ddx information is shown in the serial monitor (under the Arduino Uno platform). But If I keep the all matrix data, ddx information is not indicated in the serial monitor.

If I can use Arduino Due, this problem is easy to solve, but I should use Arduino Uno.
How to solve this problem?

I tried to use Fritzing, but same problem occurred.

Plz help me solve this problem.
Happy New Year!

void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
}

void loop() {
 // put your main code here, to run repeatedly:

 double ndof = 3, rn = 1e-8, Qn = 1e-2, fc = 5, fs = 2.56*fc, Q = Qn/fs;
 Matrixa *Klqr, *Rn, *A, *H, *G1, *R, *P, *ut, *ddx, *xk, *xe, *f;
 Matrixa *xep, *Pp, *K;
 Matrixa *temp1, *temp2, *temp3, *temp4, *temp5, *temp6;
 int loop, i;

 //Klqr = Input("Klqr.dat"); 
 Klqr = Construct(1, 6);
 double Klqr1[1][6] = { {28.4986, -42.8857, 13.5320, 8.8393, 1.9644, 2.4173} };
 for (int i = 0; i<1; i++) for (int j = 0; j<6; j++) 
   Klqr->value[i][j]=Klqr1[i][j];

 //Rn = Input("Rn.dat"); // Rn =  rn*eye(ndof), rn = 1e-8
 Rn = Construct(3, 3);
 double Rn1[3][3] = { { 1.0e-08, 0, 0 },{ 0, 1.0e-08, 0 },{ 0, 0, 1.0e-08 } };
 for (int i = 0; i < 3; i++) 
   for (int j = 0; j < 3; j++)
     Rn->value[i][j] = Rn1[i][j];

 //A = Input("A.dat"); // 6x6 
 A = Construct(6, 6);
 double A1[6][6] = {
   { 0.3403, 0.4356, -0.0459, 0.0234, -0.0016, -0.0105 },
   { 0.2238, 0.5129, 0.2491, 0.0007, 0.0616, 0.0057 },
   { 0.0127, 0.2614, 0.7255, -0.0002, 0.0073, 0.0701 },
   { -12.7712, 6.2828, 0.2413, 0.1604, 0.1834, -0.0634 },
   { 4.3283, -10.3277, 5.3008, 0.0786, 0.4291, 0.2177 },
   { 0.6244, 5.6524, -6.3042, -0.0030, 0.2597, 0.7095 } };
 for (int i = 0; i < 6; i++) 
   for (int j = 0; j < 6; j++)
     A->value[i][j] = A1[i][j];


 //H = Input("H.dat"); // 3x6
 H = Construct(3, 6);
 double H1[3][6] = {
   { -222.8904, 134.4464, -10.8691, -7.3707, -1.4984, -1.9244 },
   { 97.3915, -196.0746, 98.7614, -0.7296, -0.4335, -0.1246 },
   { -0.1069, 100.1608, -100.0507, -0.0159, 0.0893, -0.1833 } };
 for (int i = 0; i < 3; i++) 
   for (int j = 0; j < 6; j++)
     H->value[i][j] = H1[i][j];

   
 //G1 = Input("G1.dat"); // 6x1
 G1 = Construct(6, 1);
 double G11[6][1] = { { 0 },{ 0 },{ 0 },{ -1 },{ -1 },{ -1 } };
 for (int i = 0; i < 6; i++) 
   for (int j = 0; j < 1; j++)
     G1->value[i][j] = G11[i][j];

 R = ScalaCalc(Rn, fs, MUL); // R = Rn*fs
 
 temp1 = Construct(6, 6);
 double P1[6][6] = { {0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000},
 {0.0000, 0.0000, 0.0000, 0.0001, 0.0001, 0.0001},
 {0.0000, 0.0000, 0.0001, 0.0001, 0.0001, 0.0002},
 {0.0000, 0.0001, 0.0001, 0.4548, 0.4552, 0.4553},
 {0.0000, 0.0001, 0.0001, 0.4552, 0.4567, 0.4570},
 {0.0000, 0.0001, 0.0002, 0.4553, 0.4570, 0.4579} };
 for (int i = 0; i < 6; i++) 
   for (int j = 0; j < 6; j++)
     temp1->value[i][j] = P1[i][j];  

 P = ScalaCalc(temp1, 1e-6, MUL); // P = 1.0e-06*P'

 ut = Construct(5, 1);
 double ut1[5][1] = {{-0.0001},{-0.0462},{-0.3666},{-0.3872},{0.2063}};
 for (int i = 0; i < 5; i++) 
   for (int j = 0; j < 1; j++)
     ut->value[i][j] = ut1[i][j];

 ddx = Construct(5,3);
 double ddx1[5][3] = { 
     {-1.2543382e-04,  -1.2543382e-04,  -1.2543382e-04},
 {-1.7517468e-02,  -3.9902390e-04,   1.4804241e-05},
 {-2.1791740e-01,  -1.9624623e-02,  -1.9481384e-03},
 {-4.4175534e-01,  -1.4657928e-01,  -2.1667917e-02},
  {1.1378924e-01,  -3.1933572e-01,  -1.1632166e-01}};
 for (int i = 0; i < 5; i++) 
   for (int j = 0; j < 3; j++)
     ddx->value[i][j]=ddx1[i][j];

 Serial.println("ddx");
 Print(ddx);
 while(1);
 
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

I tried to compile the code, it has a problem with Matrixa

sketch_jan02a:10: error: 'Matrixa' was not declared in this scope

Matrixa *Klqr, *Rn, *A, *H, *G1, *R, *P, *ut, *ddx, *xk, *xe, *f;

etc etc about Matrixa.

What IDE version are you running, and or does it need a library?

Tom.. :)

shjeong: If I can use Arduino Due, this problem is easy to solve, but I should use Arduino Uno. How to solve this problem?

How much SRAM does your program need? Maybe the Uno does not have enough memory?

...R

I'm with Robin on this one; removing something and it starts working often points to memory problems.

  double Klqr1[1][6] =      //  6
  double Rn1[3][3] =        //  9
  double A1[6][6] =         // 36
  double H1[3][6] =         // 18
  double G11[6][1] =        //  6
  double P1[6][6] =         // 36
  double ddx1[5][3] =       // 15

126 doubles

Next you have all those Construct() calls; I guess another 126 doubles plus some overhead.

So about 1k of memory down the drain. What does your compiler output say about available dynamic memory?

Some possible solutions: 1) store the matrices in PROGMEM 2) directly insert data in the Constructed variables instead of copying from a matrix.

If I can use Arduino Due, this problem is easy to solve,

Out of curiosity, how would you solve it on a due?