필터 지우기
필터 지우기

I have data point which fits the line y=mx+c ? How can I write code for this?

조회 수: 25 (최근 30일)
RS
RS 2013년 12월 7일
댓글: Image Analyst 2013년 12월 15일
I have data point which fits the line y=mx+c ? How can I write code for this?

답변 (2개)

sixwwwwww
sixwwwwww 2013년 12월 7일
write as follow
x = 0:100;
m = 3;
c = 4;
y = m * x + c;
plot(x, y)
  댓글 수: 7
sixwwwwww
sixwwwwww 2013년 12월 7일
The problem is that in order to plot the equation you need to have 3 known values and one unknown value because there 4 values in equation x, y, m and c. So you should atleast have three values or if you just plot some random values of x and y and then want to find m and c then using cftool is the best option
sixwwwwww
sixwwwwww 2013년 12월 8일
편집: sixwwwwww 2013년 12월 8일
If you are given values of x and y then you can compute m and c as follow:
fitvars = polyfit(x, y, 1);
m = fitvars(1);
c = fitvars(2);

댓글을 달려면 로그인하십시오.


chitresh
chitresh 2013년 12월 7일
>>syms x y m c
>> solve(' y = m * x + c')
i think this gone solve your question, if it is solved accept the answer
  댓글 수: 4
chitresh
chitresh 2013년 12월 15일
if you done with your question, mark the answer accepted
Image Analyst
Image Analyst 2013년 12월 15일
And officially Accept answers in more than 30 other questions that you've asked.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by