Why there is a Invalid Expresssion error in my fit function?
1 次查看(过去 30 天)
显示 更早的评论
I wrote this simple code
n = [1433;2700;1000000];
s = [1170.98;780.65;390.33];
f= fit(n,s,'power1')
But the error said "invalid expression. check for missing or extra characters"
I'm not very used to Matlab and I absolutely have no idea why this error occurs.
Ofc, I installed Curve Fitting Toolbox
0 个评论
采纳的回答
the cyclist
2023-5-19
Your code works:
n = [1433;2700;1000000];
s = [1170.98;780.65;390.33];
f= fit(n,s,'power1')
Did you perhaps try to spread that code across multple lines? You might need to use line continuation, if so.
3 个评论
the cyclist
2023-5-19
It's difficult to understand what is going on with your code, when it works perfectly fine here.
Do you get this problem from a freshly restarted MATLAB session? How are you calling these lines of code?
Are you sure you have the CF toolbox installed? What do you get if you type
which -all fit
from the command line?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!