필터 지우기
필터 지우기

It seems thta the function "polyfit" doesn´t work anymore in my Matlab, how can I solve this problem?

조회 수: 5 (최근 30일)
I have a problem in working with the the function "polyfit". It seems that Matlab doesn´t recognise that function anymore.
this is my script:
x = [150 200 400 600 800 1000 1200 1400 1600];
y = [0 0.4 1.6 2.7 3.7 4.4 5.2 5.7 6];
p=polyfit(x,y,8);
this is the error messsage I get from Matlab:
Attempt to execute SCRIPT polyfit as a function:
C:\Users\pca02\Desktop\Documents\MATLAB\polyfit.m
Error in PVWPS (line 66)
p=polyfit(x,y,8);
How Can I solve this problem?
Thank you very much!
Pietro

채택된 답변

per isakson
per isakson 2012년 8월 10일
편집: per isakson 2012년 8월 10일
The error message indicates that the file, C:\Users\pca02\Desktop\Documents\MATLAB\polyfit.m, shadows the true polyfit.m. You seems to have created a file with the name polyfit.m
Run
which polyfit -all
it shall return something like
C:\Program Files\MATLAB\R2012a\toolbox\matlab\polyfun\polyfit.m
Rename your file, C:\Users\pca02\Desktop\Documents\MATLAB\polyfit.m, and run
p=polyfit(x,y,8);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by