mapping of datas in -pi to pi to 0 to 2*pi

19 visualizaciones (últimos 30 días)
Hrudananda Pradhan
Hrudananda Pradhan el 17 de Jul. de 2020
Respondida: Image Analyst el 18 de Jul. de 2020
I have datas in the range -pi to pi. How it can be converted in the range 0 to 2*pi ?

Respuestas (4)

Stephen23
Stephen23 el 17 de Jul. de 2020
mod(data,2*pi)

Bruno Luong
Bruno Luong el 17 de Jul. de 2020
data_0_2pi = mod(data,2*pi)
the domain of data does not matter actually.

Hrudananda Pradhan
Hrudananda Pradhan el 18 de Jul. de 2020
Thanks to all I got it.
These are used to map in (0, 2*pi):
mod(data,2*pi)
wrapTo2Pi(data)
data=data.*(data>=0)+(data+2*pi).*(data<0);

Image Analyst
Image Analyst el 18 de Jul. de 2020
Do you want to just shift, like this
data = data + pi;
or do you want to shift and rescale, like this:
data = rescale(data, 0, 2*pi);
??? The second snippet will take your min value and move it to zero, and make your max value 2*pi, and values in between will be proportionally linearly scaled.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by