help-octave
[Top][All Lists]

## Re: Problem loop for and image size

 From: Julien563 Subject: Re: Problem loop for and image size Date: Sat, 22 Oct 2016 13:16:18 -0700 (PDT)

```I tried to do a simple test to search the infinite value.

In my 2nde loop i have 2 infinite : upper bound and lower bound:

for
pixel_y_metres=(-ceil(nr./2).*pixel_y_metres:pixel_y_metres:floor(nr./2).*pixel_y_metres)

1) -ceil(nr./2).*pixel_y_metres = -Inf !=  -500.*e+16

-ceil(nr./2) = -500
pixel_y_metres = 0 (i don't know why? Because i define pixel_y_metres=1e+16,
before....)
pixel_x_metres = -2.06e+18 (i don't know why? Because i define
pixel_c_metres=1e+16, before....)

2) floor(nr./2).*pixel_y_metres = +Inf !=  +500.*e+16

floor(nr./2)=500
pixel_y_metres=0

In my 1st loop i have to wrong values of my bounds :

for
pixel_x_metres=(-ceil(nc./2).*pixel_x_metres:pixel_x_metres:floor(nc./2).*pixel_x_metres)

1) -ceil(nc./2).*pixel_x_metres = 1.03e+21 != -500.*e+16

2) floor(nc./2).*pixel_x_metres) = -1.03e+21 != +500*e+16

For more explications i copy and paste one more time my programm there:

% Les Constantes

G= 6.67e-11 %Attention! Revoir les unités
c=3.0e+8
M= 1,7e+38 %Masse de la masse déflectrice
z1= 2,75e+22 %Distance de la masse par rapport à la Terre
z2= 2,75e+22%Distance de la galaxie par rapport à la masse

% Liste des Variables
[nr,nc,channels]= size([A])
pixel_x1=round(nr/2)%Coordonnées de la masse
pixel_y1=round(nc/2)
pixel_x_metres=1e+16
pixel_y_metres=1e+16
pixel_x1_metres=(pixel_x_metres.*z1)./(z1+z2)
pixel_y1_metres=(pixel_y_metres.*z1)./(z1+z2)
R= (sqrt((pixel_x1_metres).^2+(pixel_y1_metres).^2)) %Rayon de la masse
déflectrice (exemple de trou noir = 1 pixel)
largeur = nr  %largeur de l'image en pixel
longueur = nc %longueur de l'image en pixel
L=(4.*G*M)./(c^2)

% Lentille gravitationnelle
B=[]

for
pixel_x_metres=(-ceil(nc./2).*pixel_x_metres:pixel_x_metres:floor(nc./2).*pixel_x_metres)

for
pixel_y_metres=(-ceil(nr./2).*pixel_y_metres:pixel_y_metres:floor(nr./2).*pixel_y_metres)

Ralpha =
(sqrt(((pixel_x_metres.*(z1+z2)./z1)-(pixel_x1_metres)).^2+(((pixel_y_metres.*(z1+z2)./z1)-pixel_y1_metres).^2)));
if Ralpha<=R;

j=round(((pixel_x_metres)./(pixel_x1_metres.*z1./(z1+z2)))+(floor(nc./2)))

i=round(((largeur+1)-pixel_y_metres./(pixel_y1_metres.*z1./(z1+z2)))+(floor(nr./2)))
B(i,j)= 0; % pixel noir
else;

nouveau_pixel_x_metres=(((pixel_x_metres)*(z1+z2)./z1)+z2.*((((pixel_x_metres)*(z1+z2)./z1)./z1)-(L/Ralpha).*(((pixel_x_metres)*(z1+z2)./z1)-(pixel_x1_metres))./Ralpha));

nouveau_pixel_y_metres=((pixel_y_metres)*(z1+z2)./z1)+z2.*((((pixel_y_metres)*(z1+z2)./z1)./z1)-(L/Ralpha).*(((pixel_y_metres)*(z1+z2)./z1)-(pixel_y1_metres))./Ralpha);

j_nouveau=round((nouveau_pixel_x_metres+(floor(nc./2)))./(pixel_y_metres))

i_nouveau=round(((largeur+1)-(nouveau_pixel_y_metres+(floor(nr./2))))./(pixel_y_metres))
B(i_nouveau,j_nouveau)=A(i,j);
endif
endfor
endfor

--
View this message in context:
http://octave.1599824.n4.nabble.com/Problem-loop-for-and-image-size-tp4680302p4680316.html
Sent from the Octave - General mailing list archive at Nabble.com.

```