Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
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

Antworten (2)

Giorgos Papakonstantinou
Giorgos Papakonstantinou am 6 Jun. 2015
You can do
A{2}
or
A{1,2}

Marlon Saveri Silva
Marlon Saveri Silva am 6 Jun. 2015
Bearbeitet: Marlon Saveri Silva am 6 Jun. 2015
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}

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by