help-octave
[Top][All Lists]

## Re: polar coordinates from [-pi, pi] to [0, 2 pi]

 From: Uwe Damm Subject: Re: polar coordinates from [-pi, pi] to [0, 2 pi] Date: Mon, 25 Feb 2019 06:10:54 +0100 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Am 24.02.19 um 13:22 schrieb Andreas Weber:
Am 24.02.19 um 12:42 schrieb insafba:
the data was firstly an x/y cartesian coordinates, which I transform to
polar coordinates ( theta, radius). here is it in the file.
moyen_cylindre.txt

okay, as I see theta goes from -pi/2 to pi/2. Do you only have a half-circle or there is a problem with your calculation form x/y to r/phi

radius jumps around +/-9, see the sign change which also indicates a problem. See plot (radius)

Try first to fix this.

Andy

Hello,

does test.m explain what you try to get, sorry not much time now, maybe today evening

clear
PI=3.1415926
x=0:0.1:4*PI;
x2=mod(x,2*pi);
y=sin(x)+x;
figure(1);clf
plot(x,y,'x-')
figure(2);clf
plot(x2,y,'x-')

a=x2(2:end)-x2(1:end-1);
a=mod(a,2*PI);
a=[x2(1),a];
x3=cumsum(a);
figure(3);clf
plot(x3,y,'x-');