# Matlab problem. Showing capital I and PI in results.

Printable View

• February 19th 2010, 05:59 AM
stnickola
Matlab problem. Showing capital I and PI in results.
Hi everybody. I've been trying to solve some really huge matrix equations in matlab. But, every time, Matlab shows me, besides number and symbols, capital letter "I" or "PI" in a solution.
I need those equations later in other function for ODE45 solver. Ofcourse, ODE doesn't recognise "I" or "PI".

Here it is some sequance from the result:

1.0*(Kp3*x3 + Kv3*x6 + x11*(cos(- 2*x2 - 2/3*PI*(exp(-2*t^3) - 1)

I define Kp3, x3, Kv3 etc. as symbols, but I didn't mention anywhere "PI" or "I".
Does sombody know what is a problem here? And what should to avoide thise.
Thank you for helping me.
• February 20th 2010, 12:01 AM
CaptainBlack
Quote:

Originally Posted by stnickola
Hi everybody. I've been trying to solve some really huge matrix equations in matlab. But, every time, Matlab shows me, besides number and symbols, capital letter "I" or "PI" in a solution.
I need those equations later in other function for ODE45 solver. Ofcourse, ODE doesn't recognise "I" or "PI".

Here it is some sequance from the result:

1.0*(Kp3*x3 + Kv3*x6 + x11*(cos(- 2*x2 - 2/3*PI*(exp(-2*t^3) - 1)

I define Kp3, x3, Kv3 etc. as symbols, but I didn't mention anywhere "PI" or "I".
Does sombody know what is a problem here? And what should to avoide thise.
Thank you for helping me.

They are the square root of -1 and the symbolic constant $\pi$. If you eval them you will get the more usual values (I'm guessing here as I am not at a machine with the Symbolic tool box at present)

CB
• February 23rd 2010, 01:34 AM
stnickola
Thank you CaptainBlack. But "eval" doesn't work here. I tried. I don't know what the problem is. Sometimes, I get really wierd solution, worse then previous one. But that depends on how big equation is. Maybe there is some problem with ram memory, I don't know.
Real problem is simulation of one adaptive algoritham for 3DOF robot. When I put for desired trajectory, for instance, pi/3*sin(2*t)+3*cos(3*t), and something similar for other two joints, state space representation of the closed loop system is ok, without "I" or "PI", but the problem is for trajectory like pi/3*sin(2*t)+3*cos(3*t)*exp(2*t^3). The equation is too big for matlab command window so I had to use fprintf function. And in fprintf new file stands "I" or "PI", when I use pi instead 3.1416.
Once, I got, in the middle of equation some wierd string array, something like "msccd" or something. But, after restarting computer, remaind only "I" or "PI".
I don't have idea what can be a problem. But, of course, thank you again for helping me.