COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### norm of sym functions

• Email
• Follow

```hi
i have a sym function
i want to take norm this function but matlab give a error as:
"Undefined function or method 'norm' for input arguments of type 'sym'"
my code for this subject is followed:

clear all
clc
% lagrang equation for scara robot
% denavet-hartenberg parameters
%     tetha    d    alpha    a
% 1     t1     d1    pi      a1
% 2     t2     0     0       a2
% 3     0      q3    0       0
syms t1 t2 q3 a1 a2 d1 td1 td2 qd3
A1=[cos(t1) sin(t1) 0 a1*cos(t1);sin(t1) -cos(t1) 0 a1*sin(t1);0 0 -1 d1;0 0 0 1];
A2=[cos(t2) -sin(t2) 0 a2*cos(t2);sin(t2) cos(t2) 0 a2*sin(t2);0 0 1 0;0 0 0 1];
A3=[1 0 0 0;0 1 0 0;0 0 1 q3;0 0 0 1];
x0=[0;0;0;1];
x1v=[0 0 d1/2];
x1h=A1*x0/2;
x2=A1*x0+A2*x0/2;
x3=A1*A2*x0+A3*x0/2;
r1h=x1h;
r1h=x1h(1:3);
r2=x2(1:3);
r3=x3(1:3);
q=[t1;t2;q3];
v1=td1*diff(r1h,t1)+td2*diff(r1h,t2)+diff(r1h,q3)*qd3;
v2=diff(r2,t1)*td1+diff(r2,t2)*td2+diff(r2,q3)*qd3;
v3=diff(r3,t1)*td1+diff(r3,t2)*td2+diff(r3,q3)*qd3;
syms m1v m1h m2 m3 I1 I1 I2 I3

T=1/2*(I1+I2+I3)*td1^2+1/2*(I2+I3)*td2^2+1/2*(norm(v1))^2+1/2*(norm(v2))^2+1/2*(norm(v3))^2
Please tell me what I do?!!
```
 0

See related articles to this posting

```On 12/24/2010 9:11 AM, hamed shorakaei wrote:
> hi
> i have a sym function
> i want to take norm this function but matlab give a error as:
> "Undefined function or method 'norm' for input arguments of type 'sym'"
> my code for this subject is followed:
(snip)
> Please tell me what I do?!!

norm is not defined for sym objects. You have two obvious choices:
1. Instead of calling the norm function, call the underlying function
you want, such as sqrt(sum(v2.^2));
2. Make a call to MuPAD via the feval(symengine,'norm',...) call. For
http://www.mathworks.com/help/toolbox/symbolic/brs6v40.html#brs6wd3
and
doc(symengine,'norm')

Alan Weiss
MATLAB mathematical toolbox documentation
```
 1