How do I do a regress like this?
Show older comments
I have a series of numbers that decrease by about the same percetentage rate with time. How do I do the regression to find the exact percentage rate it is changing?
For example, it can be something like the below:
1 100
2 95
3 91
4 86
5 80
Many thanks.
1 Comment
Walter Roberson
on 16 Sep 2023
think about logarithm
Accepted Answer
More Answers (1)
Hi @Leon
I'm not exactly sure what you want. If you're looking to find the exact percentage drop, as @Image Analyst has shown you, that's one approach. If you want to use MATLAB to create a linear regression model fit, you can do so using the 'fitlm()' function.
y = [100, 95, 91, 86, 80]; % data
x = 1:numel(y);
mdl = fitlm(x, y) % linear regression model
plot(mdl)
Categories
Find more on Linear and Nonlinear Regression 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!