fit() from Curve Fitting Toolbox not working even with examples from the documentation
조회 수: 10 (최근 30일)
이전 댓글 표시
I'm trying to use the fit() function from the curve fitting toolbox but it kept giving me an error saying "Data sizes are incompatible."
The script I'm using is directly from the documentation:
load franke
sf = fit([x, y],z,'poly23')
plot(sf,[x,y],z)
I tried it in MATLAB online and it worked perfectly, but not working in MATLAB R2021b. I tried updating it to R2022a which also didn't solve the problem. Not sure if this is a bug or I'm doing something wrong.
댓글 수: 0
채택된 답변
Matt J
2022년 3월 20일
Run the code inside a function,
>> myfunction
function myfunction
load franke
sf = fit([x, y],z,'poly23')
plot(sf,[x,y],z)
end
댓글 수: 3
추가 답변 (1개)
Image Analyst
2022년 3월 20일
What does this show
size([x, y])
size(z)
Don't use a semicolon and tell us what it says the sizes are in the command window.
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!