Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
linear equation without coefficients
조회 수: 1 (최근 30일)
이전 댓글 표시
hello. so i am a beginner in matlab and i would need some help in solving a problem. I have 2 vectors x and y with 10 values each and the equation y=a*x+b. The task is to find the values for a and b. I know how to do this on paper, but i don t know how to code it. Please help.
댓글 수: 1
답변 (1개)
William Alberg
2020년 5월 17일
I think the polyfit command is what you are looking for. It should work like this
k = polyfit(x,y,1)
a = k(1)
b = k(2)
댓글 수: 5
William Alberg
2020년 5월 18일
I have not tried that before. But it appears that the following code works.
F = @(x,xdata) x(1)*sqrt(xdata);
c = lsqcurvefit(F,0,x,z)
It can end up in a local minimum point, so you should be aware of that
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!