f



symbolic math toolbox 5.4 (matlab 2010a) is too slow compared to math toolbox 3.1

hello, i wrote down this script and it takes just few seconds to run on matlab7. I don't know why it never ends with matlab 2010. I found on internet there is a bug about this for matlab 2009 and mathworks gave also a patch but nothing about matlab 2010a. Do you know what's the problem.
After waiting a while, when i type ctrl+c  the result is


??? Operation terminated by user during ==> sym.simple>simpler at 79

In ==> sym.simple>mupadSimple at 49
    [r,h] = simpler('mllib::simplify',s,r,h,p,'100');

In ==> sym.simple at 36
    [r,h] = mupadSimple(s,p);

In ==> robot_matriciale at 87
B2=[simple(Bm(1,1)) simple(Bm(1,2)) simple(Bm(1,3));


It seems there is a problem with the "simple" command and matlab can't manage it.

The Script is the follower
Thank you
Francesco

%voglio calcolare il valore del modulo delle velocità dei baricentri
clear all
syms px py pz theta alfa beta ptheta palfa pbeta B C Cb Ab Bb


%variabili libere
q = [theta beta alfa].';

%iacobiano traslazionale e rotazionale di B: prima riga rispetto a x,
%seconda rispetto a y  e terza rispetto a z.
%prima colonna rispetto a theta, seconda rispetto beta, terza ad alfa
JpB = [cos(theta)*(C+Bb*sin(beta))         sin(theta)*Bb*cos(beta)   0;
      -sin(theta)*(C+Bb*sin(beta))         cos(theta)*Bb*cos(beta)   0;
       0                                  -Bb*sin(beta)              0];

JoB = [0 cos(theta) 0;
       0 -sin(theta) 0;
       1  0          0];
       
       
%iacobiano rot e trasl di A: prima riga rispetto a x,
%seconda rispetto a y  e terza rispetto a z.
%prima colonna rispetto a theta, seconda rispetto beta, terza ad alfa
JpA = [cos(theta)*(C+B*sin(beta)-Ab*sin(-alfa+beta))     sin(theta)*(B*cos(beta)-Ab*cos(-alfa+beta))  sin(theta)*Ab*cos(-alfa+beta);
      -sin(theta)*(C+B*sin(beta)-Ab*sin(-alfa+beta))     cos(theta)*(B*cos(beta)-Ab*cos(-alfa+beta))  cos(theta)*Ab*cos(-alfa+beta);
       0                                                 (-B*sin(beta)+Ab*sin(-alfa+beta))           -Ab*sin(-alfa+beta)            ];

JoA =  [0  sin(theta)   -cos(theta);
        0  -cos(theta)   sin(theta);
        1  0             0];

        
        
%iacobiano rot e trasl di C: prima riga rispetto a x,
%seconda rispetto a y  e terza rispetto a z.
%prima colonna rispetto a theta, seconda rispetto beta, terza ad alfa

JpC = [cos(theta)*Cb  0    0;
       -sin(theta)*Cb  0    0;
       0              0    0];

JoC = [0 0 0;
       0 0 0;
       1 0 0];  
       
       
r01 = [cos(theta) sin(theta) 0;
       -sin(theta) cos(theta)  0;
       0          0           1];

r12 = [0          0         1;
       sin(beta)  cos(beta) 0;
       cos(beta) -sin(beta) 0];

r23= [-sin(pi/2+alfa)  cos(pi+alfa) 0;
     -cos(pi/2+alfa)  -sin(alfa+pi) 0;
      0                   0        -1];


r3 = r01*r12*r23;
r2 = r01*r12;
r1 = r01;
       
       
       
syms p2beta p2alfa p2theta Mc Mb Ma
Jc   = [ 0.00009358  0           0
         0           0.00009319  -0.00000988
         0          -0.00000988  0.00008419 ]; % [kg*m^2]
Jb = [ 0.000378    0.000001    0
       0.000001    0.000032    0
       0           0           0.000389   ]; % [kg*m^2]

Ja  = [ 0.000617   -0.000001    0
       -0.000001    0.000027    0
        0           0           0.000622   ]; % [kg*m^2]

%Mc = 0.02787; % [kg]
%Mb = 0.264; % [kg]
%Ma = 0.2581; % [kg]


syms Bm Cm g
%matrice B
Bm = Mc*JpC.'*JpC+JoC.'*r1*Jc*r1.'*JoC + Mb*JpB.'*JpB+JoB.'*r2*Jb*r2.'*JoB + Ma*JpA.'*JpA+JoA.'*r3*Ja*r3.'*JoA;

B2=[simple(Bm(1,1)) simple(Bm(1,2)) simple(Bm(1,3));
   simple(Bm(2,1)) simple(Bm(2,2)) simple(Bm(2,3));
   simple(Bm(3,1)) simple(Bm(3,2)) simple(Bm(3,3))];
Bm=B2
clear B2;


%calcolo gli elementi di christoffel
for i = 1:3,
   for j= 1:3,
      for k = 1:3,
          C2(i,j,k)=0.5*(diff(Bm(i,j),q(k))+diff(Bm(i,k),q(j))-diff(Bm(j,k),q(i)));
          C2(i,j,k)=simple(C2(i,j,k));
      end
   end
end

          
%Calcolo la matrice Cm
for i = 1:3,
   for j= 1:3,
   Cm(i,j)=0;
     for k= 1:3,
     Cm(i,j) = Cm(i,j)+C2(i,j,k)*q(k);
     Cm(i,j) = simple(Cm(i,j));
     end
 end
end
 clear C2
 
 Cm
 %vettore g
 U = (Bb*cos(beta)+B*cos(beta) + Ab* sin(3/2*pi+alfa-beta));
 for i = 1:3,
 g(i) = diff(U,q(i));
 g(i)=simple(g(i));
 end
g=g.'
0
Francesco
5/15/2010 3:58:05 PM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
1466 Views

Similar Articles

[PageSpeed] 27

I'm making the same observation and find it really, very strange. Especially when the performance gap is so striking.
0
Dion
5/25/2010 10:09:08 AM
I'm making the same observation and find it really, very strange. Especially when the performance gap is so striking.
0
Dion
5/25/2010 10:10:10 AM
Dion wrote:
> I'm making the same observation and find it really, very strange. 
> Especially when the performance gap is so striking.

The two versions use completely different symbolic engines. The last few 
Matlab releases use MuPad for the symbolic engine; the ones before that 
used Maple. MuPad's language is designed to be quite similar to Maple's, 
but of course the power and correctness of the simplifiers is going to 
be different between the two (and each will have some bugs that the 
other does not have.)

If you own Maple then you can use that as the symbolic engine -- 
Maplesoft was making the interface available free for a while last year 
(for R13) and I think I saw a note in the new R14 version that said it 
was now incorporated into the standard Maple distribution, but I am not 
certain about that.
0
Walter
5/25/2010 2:30:46 PM
Reply: