-
Notifications
You must be signed in to change notification settings - Fork 3
/
exp_fun1.m
41 lines (40 loc) · 1.05 KB
/
exp_fun1.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
function [f,df] = exp_fun1(rp,xdata)
%EXP_FUN Calculates a two parameter exponential function and its
% Jacobian. For use with T1rho_map2.m.
%
% EXP_FUN(RP,XDATA) Calculates an exponential function using the two
% parameters in vector, RP, and using the independent data in vector,
% XDATA.
%
% F = EXP_FUN(RP,XDATA) Returns a vector, F, of the values of
% the exponential function for the values in XDATA.
%
% [F,DF] = EXP_FUN(RP,XDATA) Returns the Jacobian in the matrix,
% DF.
%
% NOTES: The exponential function is:
% F(RP,XDATA) = RP(1)*EXP(-XDATA/RP(2))
%
% 10-Jul-2020 * Mack Gardner-Morse
%
%#######################################################################
%
% Calculate the Exponential Function
% F(RP,XDATA) = RP(1)*EXP(-XDATA/RP(2))
%
f = rp(1)*exp(-xdata/rp(2));
%
% Calculate the Partial Derivatives (Jacobian)
%
if nargout>1
%
rp = rp(:);
xdata = xdata(:);
%
df = zeros(size(xdata,1),size(rp,1));
df(:,1) = exp(-xdata/rp(2));
df(:,2) = rp(1)*xdata.*exp(-xdata/rp(2))/(rp(2)*rp(2));
%
end
%
return