transformation of a rotary coordinate system to a static coordinate system

조회 수: 2 (최근 30일)
Tomas Makar
Tomas Makar 2022년 2월 23일
답변: Swastik Sarkar 2025년 6월 19일
Hi all,
I need to transform rotary coordinate system to a static coordinate system. I found tranformation matrix, but i dont know how to write a for cycle for this. Tba= [cos(phi) -sin(phi); sin(phi) cos(phi)] - tranformation matrix
Rba=[Xb; Yb]; are values from rotary CS. Xb, Yb are 1251208x1 vector.
Result =Tba*Rba; - this should be result.
All values turn about 0,96 degree per step. (First value is turned by 0,96 degree, second one 0,96+0,96 and so on to 360). So i need to tranform every single number step by step by i+0,96 degree to 360 degree and 1251208 times whitch is dimension of a vector of values.
Can someone help please?
Thanks.

답변 (1개)

Swastik Sarkar
Swastik Sarkar 2025년 6월 19일
There appears to be no simpler approach than iterating through all values and applying a rotation matrix with an incrementally increasing angle of 0.96 degrees per step. The implementation may be structured as follows:
It would look something like this:
% Preallocating for greater speed !
Xa = zeros(size(Xb));
Ya = zeros(size(Yb));
for i = 1:length(Xb)
    phi = i * 0.96;
    rad = deg2rad(phi);
    Tba = [cos(rad), -sin(rad); sin(rad), cos(rad)];
    Rba = [Xb(i); Yb(i)];
    Ra = Tba * Rba;
    Xa(i) = Ra(1);
    Ya(i) = Ra(2);
end
Hope this proves helpful

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by