-
Notifications
You must be signed in to change notification settings - Fork 4
/
Script_least_squares_noiseless_experiment.m
73 lines (54 loc) · 2.48 KB
/
Script_least_squares_noiseless_experiment.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
%% Monte Carlo simulation - 1 channel
clear all;
close all;
clc
addpath(genpath('src'));
addpath(genpath('src/utils'));
%-- Generate the US sequence object
us_seq = USSequence();
%-- Number of pulses in each channel
n_pulses = 20;
%-- Noise level
noise_level = 1000;
%-- Number of simulation draws
n_draws = 1000;
%-- Measurement ratios
meas_ratio = [0.01:0.01:0.20, 0.30, 0.40, 0.50];
%-- Number of channels as prior
n_cha_prior = 0;
%-- Least squares - inter-element spacing 1 wavelength
[nmse, nrmse] = benchmark(us_seq, 'LS', meas_ratio, n_cha_prior, n_pulses, n_draws, noise_level);
%-- Save the output file
filenameOut = 'results/results_1channel_least_squares_synth_pulse.mat';
save(filenameOut, 'nmse', 'nrmse', 'us_seq', 'n_pulses', 'n_draws', 'meas_ratio');
%-- Least squares - inter-element spacing 2 wavelengths
us_seq.set_element_spacing(2*us_seq.speed_of_sound/us_seq.central_frequency);
[nmse, nrmse] = benchmark(us_seq, 'LS', meas_ratio, n_cha_prior, n_pulses, n_draws, noise_level);
%-- Save the output file
filenameOut = 'results/results_1channel_least_squares_synth_pulse_2lambda.mat';
save(filenameOut, 'nmse', 'nrmse', 'us_seq', 'n_pulses', 'n_draws', 'meas_ratio');
%% Monte Carlo simulation - multiple channels
clear nmse nrmse us_seq
%-- Generate the US sequence object
us_seq = USSequence();
xm = us_seq.get_element_locations();
%-- List of number of channels onto which prior knowledge is known
list_n_cha_prior = [1, 4, 9, 19];
%-- Least-squares - inter-element spacing 1 wavelength
for jj = 1:numel(list_n_cha_prior)
n_cha_prior = list_n_cha_prior(jj);
% Benchmark
[nmse, nrmse] = benchmark(us_seq, 'LS', meas_ratio, n_cha_prior, n_pulses, n_draws, noise_level);
%-- Save the output file
filenameOut = strcat(['results/','results_', num2str(n_cha_prior+1) ,'channels_least_squares_synth_pulse.mat']);
save(filenameOut, 'nmse', 'nrmse', 'us_seq', 'n_pulses', 'n_draws', 'meas_ratio');
end
%-- Least-squares - inter-element spacing 2 wavelengths
for jj = 1:numel(list_n_cha_prior)
n_cha_prior = list_n_cha_prior(jj);
% Benchmark
[nmse, nrmse] = benchmark(us_seq, 'l1', meas_ratio, n_cha_prior, n_pulses, n_draws, noise_level);
%-- Save the output file
filenameOut = strcat(['results/','results_', num2str(n_cha_prior+1) ,'channels_least_squares_synth_pulse_2lambda.mat']);
save(filenameOut, 'nmse', 'nrmse', 'us_seq', 'n_pulses', 'n_draws', 'meas_ratio');
end