用最小二乘法拟合多项式 。

clear all
x = [1.005 1.005 1.005 1.005 1.005 1.005 1.005 1.005 0.555 0.540 0.299 0.241 0.209 0.194 0.180 0.180 0.185 0.194 0.199 0.226 0.421 0.630 0.659 0.720 0.720 0.698 0.698 0.705 0.727 0.744 ];
y = [0.639 0.639 0.639 0.639 0.638 0.638 0.638 0.638 -0.511 -0.334 -0.130 0.009 0.221 0.137 0.083 0.050 0.037 0.029 0.035 0.077 0.470 1.028 1.035 1.109 1.494 1.449 1.448 1.307 1.251 1.235 ];
p = polyfit(x,y,6);
x1= 0.0011:0.0001:1.1;
y1= polyval(p,x1);
plot(x,y,'*r',x1,y1,'-b')
为什么一直提示我Error: Missing variable or function.这是怎么回事。

2 件のコメント

Allen
Allen 2023 年 8 月 25 日
我按你的代码运行,没有报错。
DGM
DGM 2023 年 8 月 25 日
編集済み: DGM 2023 年 8 月 25 日
During 10-2022 to 11-2022 and from 5-2023 through 6-2023, the forum was inundated with southeast asian spambots run by "entertainment and gambling" sites which were stealing content from independent chinese MATLAB forums and variously using it for their own nonsensical promotional schemes. I've verified and deleted at least 500 threads that fit this form, and I wouldn't doubt that there's at least a thousand more left. It's hard to say, as the sheer volume of garbage posted in that timeframe has prompted either staff or automated features of this forum to suppress the visibility of chinese-language content.
While I cannot find this specific thread on the specific forum of interest, the timestamps and accounts indicate that it was very likely another automated tag-team posting. Searching for these things has become more difficult, as that forum seems to be aware of bot activity on their site and their response has marginally disrupted searchability.
TL;DR: in all likelihood, you are the first human to post in this thread.
EDIT: you are a human, right?

サインインしてコメントする。

 採用された回答

xilihan
xilihan 2022 年 11 月 24 日

0 投票

不需要定义,数值变量直接给赋值就可以了,你这里就是直接对矩阵A赋值了
Matlab里直接拿来赋值就可以了,不需要先定义再赋值,或者说matlab里的赋值就相当于“定义”

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConway's Game of Life についてさらに検索

タグ

質問済み:

2022 年 11 月 24 日

編集済み:

DGM
2023 年 8 月 25 日

Community Treasure Hunt

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

Start Hunting!