求用Isqnonlin进行非线性拟合问题。

公式为 [latex][630.93^(1-a)-x^(1--a)]/(1-a)=ky[/latex]
欲用Isqnonlin进行非线性拟合 p为y;q为x
y为 5 10 15 20 25 x为 125.39 96.45 79.81 60.57 46.30
拟合出 a 与 k
这是我编的程序
function F = myfun3(x)
q=[125.39,96.45,79.81,60.57,46.30];
p=5:5:25; ;
syms m n;
m=1-x(1);
n=x(2);
F=1-[630.93^x(1)-q^x(1)]/(x(1)*x(2)*p)
end %%保存为M文件 %%%%%%%%% %%
命令窗口中输入
clc
tic
x0=[0.2 -1.5];
[x,resnorm]=lsqnonlin(@myfun3,x0)
toc
出现???
Error using ==> optim\private\lsqncommon
User supplied function failed with the following error:
Error: File: C:\MATLAB7\work\myfun3.m Line: 2 Column: 35
Missing variable or function.
Error in ==> lsqnonlin at 147
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
求大神们帮忙解决 急急急!!!

 Réponse acceptée

nexayi
nexayi le 23 Nov 2022

0 votes

function test
clc
tic
x0=[0.2 -1.5];
[x,resnorm]=lsqnonlin(@myfun3,x0)
toc
function F = myfun3(x)
q=[125.39,96.45,79.81,60.57,46.30];
p=5:5:25; ;
syms m n;
m=1-x(1);
n=x(2);
F=1-(630.93^x(1)-q.^x(1))/(x(1)*x(2)*p)
x =
-8.7444 -2.6181
resnorm =
1
Elapsed time is 1.157023 seconds.
>>

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics and Optimization dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!