- Refer to the ‘Examples’ section to understand how to fit curves or surfaces to data: MathWorks Documentation.
Transfer Functions on Biologic Data Sets
5 views (last 30 days)
Show older comments
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.
>>
0 Comments
Answers (2)
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!
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)
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'})
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
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.
See Also
Categories
Find more on Waves in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!