transformation of a rotary coordinate system to a static coordinate system

2 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Swastik Sarkar
Swastik Sarkar il 19 Giu 2025
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

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Tag

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by