Problem with decision logic for 5 layers with the forward modeling method

1 view (last 30 days)
Good afternoon everyone. Can anyone answer this question for me? I have a problem with decision logic for 5 layers with the forward modeling method.
The syntax below is for 3 layers. Would you mind for helping me with the algorithm of a 5 layer forward modeling?
Thank you.
x_hole_1 = 0 ; x_hole_2 = 1000; y_hole = 500;
y_batas = [100 220 320 420 500];
v_lap = [1000 1500 2000 2500 3000];
sou_y = [50 80];
rec_y = [50 300 480];
%%%FUNGSI HITUNG TIME MODEL (DIRECT )
%%%menghitcng panjang direct ray dari source ke receiver
n_ray = length(sou_y) * length(rec_y) ;
pan_ray_total = zeros(length(sou_y),length(rec_y));
for i = 1 : length( sou_y)
for j = 1 :length(rec_y)
pan_ray_total(i,j)= sqrt((x_hole_1 - x_hole_2).^2 + (sou_y(i) - rec_y(j)).^2) ;
end
end
%%menghitung sudut tembak ray dari titik shoot
sudut_tembak = zeros(length(rec_y),length(sou_y));
for i = 1 : length(sou_y)
for j = 1 :length(rec_y)
sudut_tembak(i,j) = acosd((x_hole_2/pan_ray_total(i,j))) ;
end
end
%%%menghitung panjang tiap segmen ray yang melewati tiap blok
k = 1;
for i = 1 :length(sou_y)
for j = 1 :length(rec_y)
%%%dasar pembutaan syntax memakai simulasi sthooting dari source 1
tikpot_bts1 = ((y_batas(1)-sou_y(i))/tand(sudut_tembak(i,j)))+ x_hole_1;
pan_ray_bag(k,1) = sqrt((x_hole_1 - tikpot_bts1).^2 + (sou_y(i) - y_batas(1)).^2);
tikpot_bts2 = ((y_batas(2) - sou_y(i))/tand(sudut_tembak(i,j))) + x_hole_1;
pan_ray_bag(k,2) = sqrt((tikpot_bts1 - tikpot_bts2).^2 + (y_batas(1) - y_batas(2)).^2);
pan_ray_bag(k,3) = pan_ray_total(i,j) - (pan_ray_bag(k,1) + pan_ray_bag(k,2));
%%%loop hubungan kondisi posisi source dan receiver
if (sou_y(i) < y_batas(1)) && (rec_y(j) < y_batas(1))
%%%direct ray di blok 1
pan_ray_bag(k,1) = pan_ray_total(i,j);
pan_ray_bag(k,2) = 0;
pan_ray_bag(k,3) = 0;
elseif (sou_y(i)< y_batas(1)) && (rec_y(j) > y_batas(1)) && (rec_y(j) < y_batas (2))
pan_ray_bag(k,2)= pan_ray_total(i,j)- pan_ray_bag(k,1);
pan_ray_bag(k,3) = pan_ray_total(i,j) -(pan_ray_bag(k,1) + pan_ray_bag(k,2));
elseif (sou_y(i) > y_batas(1)) && (sou_y(i) < y_batas(2)) && (rec_y(j) < y_batas (1))
pan_ray_bag(k,2) = pan_ray_bag(k,1);
pan_ray_bag(k,1) = pan_ray_total(i,j) - pan_ray_bag(k,1);
pan_ray_bag(k,3) = pan_ray_total(i,j) - (pan_ray_bag(k,1) + pan_ray_bag(k,2));
elseif (sou_y(i) > y_batas(1)) && (sou_y(i) < y_batas(2)) && (rec_y(j) > y_batas(1)) && (rec_y(j) < y_batas(2))
%%%direct ray di blok 2
pan_ray_bag(k,1) = 0;
pan_ray_bag(k,2) = pan_ray_total(i,j);
pan_ray_bag(k,3) = 0;
elseif (sou_y(i) > y_batas(1)) && (sou_y(i) < y_batas(2)) && (rec_y(j) > y_batas(2))
pan_ray_bag(k,1) = 0;
pan_ray_bag(k,2) = sqrt((x_hole_1 - tikpot_bts2).^2 + (sou_y(i) - y_batas(2)).^2);
pan_ray_bag(k,3) = pan_ray_total(i,j) - (pan_ray_bag(k,1) + pan_ray_bag(k,2));
elseif (sou_y(i) > y_batas(2)) && (rec_y(j) < y_batas(1))
pan_ray_bag(k,3) = sqrt((x_hole_1 - tikpot_bts2).^2 + (sou_y(i) - y_batas(2)).^2);
pan_ray_bag(k,2) = pan_ray_bag(k,1) - pan_ray_bag(k,3);
pan_ray_bag(k,1) = pan_ray_total(i,j) - abs(pan_ray_bag(k,2) + pan_ray_bag(k,3));
elseif (sou_y(i) > y_batas(2)) && (rec_y(j) > y_batas(1)) && (rec_y(j) < y_batas (2))
pan_ray_bag(k,1) = 0;
pan_ray_bag(k,2) = sqrt((x_hole_1 - tikpot_bts2).^2 + (sou_y(i) - y_batas(2)).^2);
pan_ray_bag(k,3) = pan_ray_total(i,j) -(pan_ray_bag(k,1) + pan_ray_bag(k,2));
elseif (sou_y(i) > y_batas(2)) && (rec_y(j) > y_batas(2))
%%%direct ray di blok 3
pan_ray_bag(k,1) = 0;
pan_ray_bag(k,2) = 0;
pan_ray_bag(k,3) = pan_ray_total(i,j) - (pan_ray_bag(k,1)+pan_ray_bag(k,2));
end
k = 1 + k;
end
end
%%%menghitung matriks forward
dt_cal = pan_ray_bag *(1./v_lap');
for l = 1 : length (sou_y)
d(l,:) = dt_cal((length(rec_y)*(l-1))+1 : length (rec_y)*l,1);
end
G = pan_ray_bag ;

Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!