필터 지우기
필터 지우기

Assemble the generated graph

조회 수: 4 (최근 30일)
Patricio Morales
Patricio Morales 2022년 4월 2일
답변: DGM 2022년 4월 2일

Greetings community, I would like to know if it is possible to represent this graph but without the jumps that can be seen in it. The ordinate axis consists of the Orientation of an object that rotates once and the abscissa axis consists of the time in frames. The function used to generate this graph is through regionprops (Orientation) My idea and interest is to be able to see the graph without those jumps and that it remains continuous (A single function represented) Thank you very much in advance and I enclose part of the code for generate it

plot(Mtaco(:,1), Mtaco(:,5),'o'), grid on, title('Orientacion');
Mtaco(:,5) Represents the matrix generated by a sequence of photos. The orientation corresponds to the Centroid (regionprops function) which keeps the orientation of the object with respect to the passage of time
Mtaco = [Mtaco; ii s(ss).Area s(ss).Centroid s(ss).Orientation];
Mtaco It is a matrix in which data of time, area, centroid and orientation are stored.
Thank you very much for your attention and for your help.

채택된 답변

DGM
DGM 2022년 4월 2일
You'll have to adapt it to your data, but here are two ways:
% an example vector with wrapping every 180deg
x = linspace(-90,120,100);
th = 181*sind(x)+181;
th = mod(th,180)-90;
plot(th)
grid on
% do it the basic way
dth = [0 diff(th)];
dth = sign(dth).*(abs(dth)>150);
offset = cumsum(dth)*180;
newth = th - offset;
plot(newth)
grid on
% using unwrap
newth2 = unwrap(deg2rad(th*2));
newth2 = rad2deg(newth2)/2;
plot(newth2)
grid on

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by