필터 지우기
필터 지우기

computing a sequence of vectors

조회 수: 4 (최근 30일)
genevois pierre
genevois pierre 2020년 12월 31일
답변: Birdman 2021년 1월 13일
the sequence is defined, for i = 1:n, by this vectorial recurrence relation :
[A(i+1); B(i+1)] = Q * [A(i); B(i)] + [C; D]
with Q = [-(L+d)/d, L/d; -L/d, (L-d)/d]
and [C; D] = 0.5 * q * sin(alpha) * [L + d; L^2/d]
Where n, L, d, q, alpha are given constants
I want to compute symbollically [A(i); B(i)] as a function of [A(n); B(n)], which is known.
How to model in matlab the quantities [A(i); B(i)] for i = 1:n ?

채택된 답변

Birdman
Birdman 2021년 1월 13일
Try the following code:
n=1;L=1;d=1;q=1;%randomly given
syms alpha
C=0.5*q*sin(alpha)*[L+d];
D=0.5*q*sin(alpha)*[L^2/d];
Q=[-(L+d)/d,L/d;-L/d,(L-d)/d];
n=10;%randomly given
A=sym(zeros(n,1));B=sym(zeros(n,1));%preallocation
for i=1:n
temp=Q*[A(i);B(i)]+[C;D];
A(i+1)=temp(1);
B(i+1)=temp(2);
end
Then display the values to see if they are correctly obtained.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by