From: Francesco on 15 May 2010 11:58 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.'
From: Dion on 25 May 2010 06:09 I'm making the same observation and find it really, very strange. Especially when the performance gap is so striking.
From: Dion on 25 May 2010 06:10 I'm making the same observation and find it really, very strange. Especially when the performance gap is so striking.
|
Pages: 1 Prev: Survey on code reuse by MATLAB users Next: Storing multiple Matrix from 'for' loop |