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

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 Kommentare

Allen
Allen am 25 Aug. 2023
我按你的代码运行,没有报错。
DGM
DGM am 25 Aug. 2023
Bearbeitet: DGM am 25 Aug. 2023
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?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

xilihan
xilihan am 24 Nov. 2022

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Mehr zu Conway's Game of Life finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 24 Nov. 2022

Bearbeitet:

DGM
am 25 Aug. 2023

Community Treasure Hunt

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

Start Hunting!