transformation of a rotary coordinate system to a static coordinate system
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!