forked from maidens/Flip-Angle-Design-Toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrajectories_with_profile.m
More file actions
64 lines (44 loc) · 1.21 KB
/
trajectories_with_profile.m
File metadata and controls
64 lines (44 loc) · 1.21 KB
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
function y_mean = trajectories(parameters, known_parameters, Pi, alpha, u)
% number of discretization points within profile
M = length(Pi) - 1;
%% Specify system model
% parameters
kTRANS = parameters(1);
kPL = parameters(2);
R1P = known_parameters(1);
R1L = parameters(3);
B1 = 1;
% compute B1-modified flip angles
alpha = B1*alpha;
% define system matrices for differential eq.
% dx/dt = A*x(t) + B*u(t)
% y(t) = C*x(t) + D*u(t)
% two-site exchange model with input feedthrough
A = [ -kPL-R1P 0 ;
kPL -R1L];
B = [kTRANS; 0];
C = eye(2);
D = [0; 0];
% define repetition time
TR = 2;
% define number of acquisitions
N = 30;
% discretize system
sys = ss(A, B, C, D);
sysd = c2d(sys, TR);
Ad = sysd.A;
Bd = sysd.B;
%% Compute trajectories
x = zeros(2, N, M+1);
y = zeros(2, N-1, M+1);
for i=1:M+1
for t=1:N
x(:, t+1, i) = Ad * cos(alpha(:, t).*(Pi(i))) .* x(:, t, i) + Bd*u(t);
y(:, t, i) = sin(alpha(:, t).*(Pi(i))) .* x(:, t, i);
end
end
pyr_output_surface = reshape(y(1, :, :), N, M+1);
la_output_surface = reshape(y(2, :, :), N, M+1);
%% Compare z-averaged signal with "ideal" central signal
y_mean = [mean(pyr_output_surface, 2) mean(la_output_surface, 2)];
end