linear regression matlab code
显示 更早的评论
.
7 个评论
Star Strider
2021-12-20
Star Strider
2021-12-20
Please carefully read the documentation page I linked to, then try again!
It is neither appropriate nor desirable to expect the MATLAB Answers contributors to solve homework problems.
In polite society, this is known as cheating and is never appropriate.
.
Rik
2021-12-20
Do you see the irony of asking for help and then commenting 'please don't tell me what to do'?
The Matlab documentation is really good. It is actually very good advice to direct you to it.
If you respond with 'it failed', the only advice people can give you is: do something different.
The documentation contains examples. Did you try to adapt them to your data?
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If your main issue is with understanding the underlying concept, you may consider re-reading the material you teacher provided and ask them for further clarification.
Rik
2021-12-20
The original tags ("matlab code", "matlab compiler", "matlab", and "code") were replaced by "homework", "polyfit", "regression" and "I do not like help documentation", and the release (R2021b) was removed.
Additionally, the name of the OP was changed, I suspect in order to avoid their teacher finding this thread.
Original question:
linear regression matlab code
how can i write a matlab code with 2 datas and years. I want to make matlab code with linear regression. we have to plot this code
my datas: x=[128.46 125.90 123.90 121.96 117.89 114.89 110.41 107.47 105.59 103.45 101.79 99.66 97.53 94.91 93.45 93.14 91.98 90.11] for world
y=[132.20 126.23 121.04 117.65 113.95 114.40 113.66 111.01 108.84 111.25 110.24 107.92 105.45 103.43 101.01 96.98 92.53 89.08] for turkey
years=between 2000-2017
Eeee Yyyy
2021-12-20
编辑:Walter Roberson
2021-12-20
Image Analyst
2021-12-20
@Eeee Yyyy, well that really backfired on you. What you said reflects way more badly on you than on Rik and Star who've shown themselves over many years to be honorable, polite, and helpful. That may be the last question anyone ever answers from you.
Eeee Yyyy
2021-12-20
回答(1 个)
Image Analyst
2021-12-20
编辑:Image Analyst
2021-12-20
1 个投票
See my attached polyfit demo. Adapt as needed.

类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!