How to make slope 1in fitlm?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
behnam ashtarayeh
le 18 Fév 2021
Réponse apportée : behnam ashtarayeh
le 19 Fév 2021
Hello there,
Is it possible to force slope to 1 in in the fitlm function.
Many thanks!
Mohammad
1 commentaire
the cyclist
le 18 Fév 2021
I think you need to post some more information about what you are trying to do. Are you asking if you can fit a model of the form
y = a + x
and estimate the value of the intercept a, using fitlm?
Réponse acceptée
the cyclist
le 19 Fév 2021
I don't believe you can do it with fitlm, but you can with fitnlm:
% Set seed for reproducibility
rng default
% Make up some data that obeys your model, with a little noise
x = (1:10)';
y = 7 + x + 0.05*randn(size(x));
% Tabulate the data. (fitnlm does not require this, but it is convenient)
tbl = table(x,y);
% Define the fit equation
f = @(F,x) F(1) + x;
% Define starting guess for parameter
b0 = 1;
% Fit the data
mdl = fitnlm(tbl,f,b0)
0 commentaires
Plus de réponses (2)
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!