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

19 views (last 30 days)
I have datas in the range -pi to pi. How it can be converted in the range 0 to 2*pi ?

Answers (4)

Stephen23
Stephen23 on 17 Jul 2020
mod(data,2*pi)

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

Hrudananda Pradhan
Hrudananda Pradhan on 18 Jul 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 on 18 Jul 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.

Tags

Community Treasure Hunt

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

Start Hunting!