-
Notifications
You must be signed in to change notification settings - Fork 0
/
TS_random.m
executable file
·47 lines (35 loc) · 1.12 KB
/
TS_random.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Try out random speed maps, testing the stability of the
% method/implementation
% Also use a wall with speed map values = 0, in order to test
% stability.
% Try different amplitudes for the random noise, to get different
% warning messages.
%% Setup
% clear all;
close all;
% Add path of functions
addpath('./functions');
% Random with an obstacle
m = 100; dy = 1; Ly = m*dy;
n = 100; dx = 1; Lx = n*dx;
Dxyz = [dx dy];
% Random amplitude. Vary this relative to 1 in order to see the effect
% of extreme speed map values
RA = 3;
% Wall configuration
w = 2; l = floor(sqrt(m*n)/3); corner = floor([3/5*n, 3/5*m]);
F2 = ones(m,n) + RA*rand(m,n);
F2(corner(2):corner(2)+l,corner(1):corner(1)+w) = 0;
F2(corner(2):corner(2)+w,corner(1):corner(1)+l) = 0;
% save('data/SpeedMaps.mat','F2')
% load('data/SpeedMaps.mat','F2');
%% Calc
SPs = [corner(1)+5, corner(2)+5]';
% SPs = getPoints(getNodes(SPs,Dxyz),Dxyz);
[T2 eFlag] = fm(F2,SPs,Dxyz,struct('implementation','C++','order',2));
% T2 = msfm2d(F2,SPs,1,0);
%% Plot
figure(1);
imshow(T2,[],'Init','fit','XD',[1 Lx],'YD',[1 Ly]);
title('Speed map with noise and a wall');
colormap(hot());