Clear Filters
Clear Filters

Transfer Functions on Biologic Data Sets

2 views (last 30 days)
Kyle
Kyle on 7 Aug 2024
Commented: Star Strider on 8 Aug 2024
I have blast data from 3 different organisms. Two animals and one human set. I am looking to develop a transfer function to translate the data sets from animal set to the human data set. I also have the ambient pressure from outside of the body for normalization as well as weight, speed of the wave, and weight of the individual body parts. I only have acess to the following toolboxes:
MATLAB Version 9.8 (R2020a)
Curve Fitting Toolbox Version 3.5.11 (R2020a)
Deep Learning Toolbox Version 14.0 (R2020a)
GUI Layout Toolbox Version 2.3.6 (R2023a)
Signal Processing Toolbox Version 8.4 (R2020a)
Statistics and Machine Learning Toolbox Version 11.7 (R2020a)
I want to be able to set up some sort of optimizaiton funciton that would work between both of the animal models, independetly. Likely a second order model. I have attached the raw data of the pressures as a CSV. Each of the data sets are computed at 0.8Mhz and the data listed by row is an maximum individual test, not a continous data set.
I am looking for gudiance on how to start this.
>>

Answers (2)

Garmit Pant
Garmit Pant on 7 Aug 2024
Hello Kyle,
To develop a transfer function to translate the blast data from animal models to the human dataset, you can use the tools available in the Curve Fitting Toolbox to perform the optimization and fitting. Given the nature of your question, I can demonstrate a general method to set up a second-order model and fit your data to such a model, rather than providing you with the exact optimizations.
Please follow the code snippet below to understand how to set up a second-degree model and fit your data to it:
% Step 1: Load the Data
% Load the data into ‘lunginset’ using the ‘Data Import Tool’ by double clicking on the file in the ‘Current Folder’ window
data = lunginset;
% Extract the relevant columns
ferret_incident = data.FerretIncident;
ferret_lung = data.FerretLungPressure;
human_incident = data.PMHSIncidentPressure;
human_lung = data.PMHSLungPressure;
nhp_incident = data.NHPIncident;
nhp_lung = data.NHPLungPressure;
% Step 2: Normalize the Lung Pressures using Incident Pressures
normalized_ferret_lung = ferret_lung ./ ferret_incident;
normalized_human_lung = human_lung ./ human_incident;
normalized_nhp_lung = nhp_lung ./ nhp_incident;
% Step 3: Define the Model (Second-order polynomial)
model = @(b, x) b(1) * x.^2 + b(2) * x + b(3);
% Step 4: Fit the Model to Ferret Data
opts = fitoptions('Method', 'NonlinearLeastSquares', 'StartPoint', [1, 1, 1]);
fitType = fittype('b1*x^2 + b2*x + b3', 'independent', 'x', 'coefficients', {'b1', 'b2', 'b3'});
[fitresult_ferret, gof_ferret] = fit(normalized_ferret_lung, normalized_human_lung, fitType, opts);
% Fit the Model to NHP Data
[fitresult_nhp, gof_nhp] = fit(normalized_nhp_lung, normalized_human_lung, fitType, opts);
% Step 5: Optimize the Parameters (if necessary)
% You can use additional optimization techniques if needed
% Step 6: Validate the Model
% Compare the fitted results with the human data
predicted_human_from_ferret = model(coeffvalues(fitresult_ferret), normalized_ferret_lung);
predicted_human_from_nhp = model(coeffvalues(fitresult_nhp), normalized_nhp_lung);
% Plot the results for validation
figure;
subplot(2,1,1);
plot(normalized_ferret_lung, normalized_human_lung, 'o', normalized_ferret_lung, predicted_human_from_ferret, '-');
title('Ferret to Human Data');
legend('Actual Human Data', 'Predicted Human Data');
xlabel('Normalized Ferret Lung Pressure');
ylabel('Normalized Human Lung Pressure');
subplot(2,1,2);
plot(normalized_nhp_lung, normalized_human_lung, 'o', normalized_nhp_lung, predicted_human_from_nhp, 'o');
title('NHP to Human Data');
legend('Actual Human Data', 'Predicted Human Data');
xlabel('Normalized NHP Lung Pressure');
ylabel('Normalized Human Lung Pressure');
On fitting the data on the first 30 rows, thereby avoiding missing data, I obtained the following results.
This should give you a starting point and a template to perform your task with the tools available in the toolboxes that you can access.
For further understanding, kindly refer to the following MathWorks documentation:
I hope you find the above explanation and suggestions useful!
  1 Comment
Kyle
Kyle on 8 Aug 2024
And if I was to add other input conditions such as weight, or any constants that are derived from body conditions. Would those go into the function that you developed in step 3?

Sign in to comment.


Star Strider
Star Strider on 8 Aug 2024
The data do not appear to have anything in common, and several are missing. (The plots here are sorted by the independent variables, that I have termed the ‘Incident’ variables.)
The idea of a ‘transfer function’ implies a frequency-based expression of however I am not certain what tthe inputs and outputs are in this instance. This is complicated by the nature of the data. That would also require that the data be regularly sampled in order to calculate their Fourier transforms, and they are so disparate that would not be appropriate.
What sort of relation do you want between the data? One option would simply be to interpolate (thhere are several funcitons to do this, for example interp1), however with respect to some of the data, this would involve an extrapolation, and extrrapolations of the ‘Ferret’ or ‘NHP’ data to the ‘PMHS’ data would be extreme, since they have very little in common. There is no reason to assume that those extrapolations would be at all accurate, much less reliable. A regression would have the same problems.
T1 = readtable('lunginset.csv', 'VariableNamingRule','preserve');
disp(T1)
Ferret Incident Ferret Lung Pressure PMHS Incident Pressure PMHS Lung Pressure NHP Incident NHP Lung Pressure _______________ ____________________ ______________________ ____________________ ____________ _________________ 7.3006 6.0947 11.153 5.8322 4.8064 2.9359 12.419 13.591 11.08 5.6407 5.7547 2.9158 13.502 18.15 26.627 15.517 10.468 6.0277 18.217 23.503 27.433 18.92 11.056 6.0318 5.907 6.0416 43.627 31.36 18.505 11.275 17.357 18.197 25.827 27.654 13.671 10.235 19.365 17.227 11.843 6.8671 23.32 15.092 7.186 5.7315 12.155 7.7653 18.544 14.691 12.187 7.9471 26.976 29.87 4.2681 3.0381 15.769 13.543 40.443 42.264 10.57 6.5558 23.596 17.491 11.208 4.7718 18.198 11.519 11.445 13.078 9.4587 3.5979 17.719 14.462 14.613 16.109 26.624 12.628 4.5954 3.0979 18.229 20.284 26.333 16.436 4.8551 3.1622 6.3318 5.4459 41.253 40.04 5.0341 3.9259 12.873 15.17 11.153 6.3304 10.577 7.9241 10.207 10.746 11.08 6.1432 8.4851 9.2707 14.455 14.338 26.627 21.383 8.2862 7.7484 23.961 17.88 27.433 20.334 13.556 15.538 6.4588 5.245 43.627 29.096 14.151 16.605 11.754 11.058 25.827 24.657 14.673 22.423 13.489 13.857 11.843 5.8246 26.287 20.845 6.047 5.1856 12.155 6.222 26.913 29.695 7.1909 5.9545 26.976 30.319 18.466 27.364 12.793 9.9787 40.443 44.628 13.874 15.762 13.277 13.215 11.208 4.832 14.657 16.729 24.987 16.388 9.4587 3.7285 14.183 16.847 17.623 17.336 26.624 15.262 18.651 16.567 6.8857 8.1118 26.333 15.33 12.681 16.655 11.118 15.012 41.253 24.554 24.935 23.576 6.0598 8.2016 NaN NaN 14.421 16.725 13.107 17.106 NaN NaN 4.6786 3.7845 19.299 22.15 NaN NaN 3.9222 2.6399 23.503 NaN NaN NaN 7.9823 7.536 6.6339 5.6176 NaN NaN 8.7042 5.6448 12.23 10.996 NaN NaN 3.4596 3.7787 13.696 16.639 NaN NaN 9.7698 8.7789 7.1356 5.4598 NaN NaN 11.877 17.314 14.691 16.834 NaN NaN 17.778 24.907 14.361 15.867 NaN NaN 4.9075 4.3363 15.084 16.026 NaN NaN 8.2721 8.946 NaN NaN NaN NaN 17.328 19.415 NaN NaN NaN NaN 13.513 12.434 NaN NaN NaN NaN 22.244 17.448
VN = T1.Properties.VariableNames;
figure
hold on
for k = 1:2:size(T1,2)
DN = extractBefore(VN{k},' ');
[~,idx] = sort(T1{:,k});
plot(T1{idx,k}, T1{idx,k+1}, '.-', 'DisplayName',DN)
end
hold off
grid
xlabel('Incident')
ylabel('Lung Pressure')
title('Sorted Data')
legend('Location','best')
for k = 1:2:size(T1,2)
TA = [T1{:,k} T1{:,k+1}];
TA = rmmissing(TA);
x = TA(:,1);
y = TA(:,2);
B(:,k) = [x.^2 x ones(size(x))] \ y;
end
B = B(:,1:2:end);
DN = cellfun(@(x)extractBefore(x,' '), VN(1:2:size(VN,2)), 'Unif',0);
Parameters = array2table(B, 'VariableNames',DN, 'RowNames',{'x^2','x','Intercept'})
Parameters = 3x3 table
Ferret PMHS NHP _________ __________ _________ x^2 -0.055544 -0.0043134 -0.020394 x 2.4247 1.1762 1.5468 Intercept -7.7462 -7.0648 -3.4791
RGB = 'rgb';
figure
hold on
for k = 1:2:size(T1,2)
TA = [T1{:,k} T1{:,k+1}];
TA = rmmissing(TA);
DN = extractBefore(VN{k},' ');
[~,idx] = sort(TA(:,1));
x = TA(idx,1);
yfit = [x.^2 x ones(size(x))] * B(:,ceil(k/2));
hs1 = scatter(TA(idx,1), TA(idx,2), 15, RGB(ceil(k/2)), 'o', 'filled', 'DisplayName',DN);
plot(x, yfit, '-', 'Color',RGB(ceil(k/2)), 'LineWidth',2, 'DisplayName','Regression')
end
hold off
grid
xlabel('Incident')
ylabel('Lung Pressure')
title('Data & Regression')
legend('Location','best')
.
  5 Comments
Kyle
Kyle on 8 Aug 2024
It is less that relationship and more I have a fit from NHP and I want that fit to match up with the PMHS with inputs of weight, wave speed, size, pressure and a few constants to a secondary species such that the Blue line lays over the green line after some fiddling and inputted constants.
Star Strider
Star Strider on 8 Aug 2024
@Kyle — If you provide those values and an appropriate mathematical relationship (model) that can be used to fit the data (estimate the relevant parameters), that might be an option for at least part of the ‘Incident’ range of ‘PMHS’. (I have no idea what you are doing or what that model would include.) However since the ‘Incident’ ranges of ‘NHP’ and ‘PMHS’ definitely overlap only in a limited range of ‘Incident’, only part of those values can be approximated.
I would fit them only over the ranges of values that they have in common, completely avoiding extrapolation. That would also allow you to compare the estimated parameters of the models for each group.

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!