i confuse using syms variable
Show older comments
dear all
i run the following code :
clc
clear all
N=6; % number of disks
L=0.08; % the length of each segment
x = sym('x', [1 3*N], 'real');
for i=1:N
alf(i)=x(1,3*i-2);
bet(i)=x(1,3*i-1);
gam(i)=x(1,3*i);
tet(i)=sqrt((alf(i))^2+(bet(i))^2);
calf(i)=cos(alf(i)); salf(i)=sin(alf(i));
cbet(i)=cos(bet(i)); sbet(i)=sin(bet(i));
cgam(i)=cos(gam(i)); sgam(i)=sin(gam(i));
ctet(i)=cos(tet(i)); stet(i)=sin(tet(i)); vtet(i)=1-cos(tet(i));
end
plcl(:,1)=zeros(3,1); % rows for xyz position, cols for disk, 3rd dim for time
for i=1:N
plcl(:,i+1)= L*[(bet(i)*vtet(i))/(tet(i)^2);-(alf(i)*vtet(i))/(tet(i)^2 );(stet(i))/tet(i)];
end
and i got this error :
The following error occurred converting from sym to double:
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use VPA.
Error in ENERJYplus1 (line 36)
plcl(:,i+1)=
L*[(bet(i)*vtet(i))/(tet(i)^2);-(alf(i)*vtet(i))/(tet(i)^2
);(stet(i))/tet(i)];
i really appreciated if someone help me that y i got this error and what s the solotion ?
and i should mention that i need to use diff for R at my next step
and i think i could use this code in past ver of matlab
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!