求用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] = ...
求大神们帮忙解决 急急急!!!

 채택된 답변

nexayi
nexayi 2022년 11월 23일

0 개 추천

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.
>>

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

질문:

2022년 11월 23일

답변:

2022년 11월 23일

Community Treasure Hunt

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

Start Hunting!