Simplificar el resultado como valor numerico

23 views (last 30 days)
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

Answers (1)

Alan Stevens
Alan Stevens on 21 Mar 2024
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

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!