How to make slope 1in fitlm?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
behnam ashtarayeh
el 18 de Feb. de 2021
Respondida: behnam ashtarayeh
el 19 de Feb. de 2021
Hello there,
Is it possible to force slope to 1 in in the fitlm function.
Many thanks!
Mohammad
1 comentario
the cyclist
el 18 de Feb. de 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?
Respuesta aceptada
the cyclist
el 19 de Feb. de 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 comentarios
Más respuestas (2)
Ver también
Categorías
Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!