Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to select a cell from an array when this array is made of functions of a parameter?

조회 수: 1 (최근 30일)
Dear all,
Consider an array
A = [a(t) b(t) c(t)].';
I want to select b(t). However, when I enter "A(2)", MatLab returns
a(2)
b(2)
c(2)
instead of
b(t).
How could we select get b(t) in this case?
Thanks

답변 (2개)

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015년 6월 6일
You can do
A{2}
or
A{1,2}

Marlon Saveri Silva
Marlon Saveri Silva 2015년 6월 6일
편집: Marlon Saveri Silva 2015년 6월 6일
Thanks. But MatLab returns this error:
Error using symfun/subsref (line 143)
Cell indexing and structure indexing are not implemented for symbolic functions.
This is my code:
clear
clc
%%Parameters
l = 12;
h = 0.9;
%%Coord. Systems
syms Alpha(t) Beta(t) Gama(t)
S_1_0=[ 1 0 0 ; 0 cos(Alpha) sin(Alpha) ; 0 -sin(Alpha) cos(Alpha)];
S_2_1=[ cos(Beta) 0 -sin(Beta) ; 0 1 0 ; sin(Beta) 0 cos(Beta)];
S_3_2=[ cos(Gama) sin(Gama) 0 ; -sin(Gama) cos(Gama) 0 ; 0 0 1];
S_3_0=S_3_2*S_2_1*S_1_0
%%Position, Veloc, Acc...
rc=l.*[sin(Gama) -cos(Gama) 0].' + S_3_0*[0 0 h].';
vc=fulldiff(rc,t);
ac=fulldiff(vc,t);
ac_y=ac{2}

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by