Simplificar el resultado como valor numerico

4 次查看(过去 30 天)
theta=30*pi/180 ;
p1=[2;3] ;
syms x1x0 x1y0 y1x0 y1y0 theta;
x01=[x1x0; x1y0];
y01=[y1y0; y1y0];
R01=[x01 y01] ;
x0_1=[cos(theta); sin(theta)]; % =[x1*x0; x1*y0]
y0_1=[-sin(theta); cos(theta)];% =[y1*x0; y1*y0]
R01=[x0_1 y0_1] ;
p0=R01*p1 ;
subs(p0,theta,30*pi/180) %resultado de la substitucion
El resultado de esta substitucion da:
ans =
3^(1/2) - 3/2
(3*3^(1/2))/2 + 1
Pero necesito la respuesta numerica de esa matrix es decir algo así:
ans=
0.2321
3.5981

回答(1 个)

Alan Stevens
Alan Stevens 2024-3-21
Why not simply:
p1=[2;3] ;
x0_1=@(theta) [cos(theta); sin(theta)]; % =[x1*x0; x1*y0]
y0_1=@(theta)[-sin(theta); cos(theta)];% =[y1*x0; y1*y0]
R01=@(theta)[x0_1(theta) y0_1(theta)] ;
p0=@(theta) R01(theta)*p1 ;
p0(30*pi/180) %resultado de la substitucion
ans = 2×1
0.2321 3.5981

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by