doseResponse function rank deficient warning
2 views (last 30 days)
Show older comments
Hi,
I've been running the doseResponse function downloaded from here. However, I've been having trouble generating a sigmoidal curve that fits my data. By running the following code, I get the following error and produce the following graph. Does anyone know how I can fix this? Thanks.
doseResponse(conc_nm_hed,resp_conc_hed)
xlabel('5HT Dose (nm)','FontSize',20)
ylabel('Normalized Response to Stimuli (\DeltaF / F)','FontSize',20)'
Warning: Rank deficient, rank = 3, tol = 1.196971e-11.
> In nlinfit>LMfit (line 587)
In nlinfit (line 284)
In doseResponse (line 47)
Warning: Rank deficient, rank = 1, tol = 3.802134e-12.
> In nlinfit>LMfit (line 587)
In nlinfit (line 284)
In doseResponse (line 47)
Warning: Some columns of the Jacobian are effectively zero at the solution, indicating that the model is insensitive to some of its parameters.
That may be because those parameters are not present in the model, or otherwise do not affect the predicted values. It may also be due to
numerical underflow in the model function, which can sometimes be avoided by choosing better initial parameter values, or by rescaling or
recentering. Parameter estimates may be unreliable.
> In nlinfit (line 381)
In doseResponse (line 47)
ans =
-5.2168e+07
0 Comments
Answers (1)
Riya
on 22 Jan 2024
Hello Aaron,
The warning message you are seeing indicates that the function `nlinfit` is encountering some issues while fitting the sigmoidal curve to your data. The warnings suggest that the matrix used in the fitting process is rank deficient, meaning that it does not have full rank.
To address this issue, you can try normalizing your data or applying a transformation to make it more suitable for fitting.
Here's an example of how you can normalize your response data before fitting the curve:
% Normalize the response data
normalized_resp = (resp_conc_hed - min(resp_conc_hed)) / (max(resp_conc_hed) - min(resp_conc_hed));
% Fit the sigmoidal curve using nlinfit
fit_params = nlinfit(conc_nm_hed, normalized_resp, @sigmoidal_function, initial_params);
% Plot the fitted curve
x = linspace(min(conc_nm_hed), max(conc_nm_hed), 100);
y_fit = sigmoidal_function(fit_params, x);
plot(conc_nm_hed, normalized_resp, 'o')
hold on
plot(x, y_fit)
xlabel('5HT Dose (nm)','FontSize',20)
ylabel('Normalized Response to Stimuli (\DeltaF / F)','FontSize',20)
legend('Data', 'Fitted Curve')
In this example, `sigmoidal_function` is a custom function that defines the sigmoidal curve model. You can replace it with your own function that represents the model you want to fit.
For more information you can refer following articles for more information:
0 Comments
See Also
Categories
Find more on Curve Fitting Toolbox 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!