How can I make a fuction that takes two points and returns the coefficients a, b
4 次查看(过去 30 天)
显示 更早的评论
How can I make a fuction that takes two points p1 and p2 in 2D plane as input parameters
and returns the coefficients a, b of a linear function f(x) = a*x + b that crosses these points. The points are defined as vectors of two
values: pi =[xi, yi], but without using any ToolBoxes and cycles?
function [a,b] = linfunc(P1, P2)
1 个评论
回答(2 个)
John D'Errico
2022-12-9
Surely this is homework. So I hope people do not do your homework for you. At the same time, it is easy to find the formulas online, for example here:
0 个评论
Image Analyst
2022-12-10
See attached polyfit demo and make the obvious modifications to it to solve your problem.
This looks like a homework problem. If you have any questions ask your instructor or read the link below to get started:
Obviously we can't give you the full solution because you're not allowed to turn in our code as your own.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!