请教一下这一段matlab程序的问题(在线等)

来源:百度知道 编辑:UC知道 时间:2024/09/18 07:49:01
wcdma = [1000,1626,3300,4000,5000,6100,12700,16000,23400];
wx = [4.75,5,5.75,6,6.16,6.5,7.5,7.92,8.4];

myfun = inline('A(2) / (1 + (A(2) / A(1) -1)* exp(A(3) * t ))','t','A');

A = nlinfit(wx,wcdma,myfun,[ 0 ,0 ,0 ]);

a = A(1);

b = A(2);

c = A(3);

错误为

??? Error using ==> nlinfit at 114
The inline model function generated the following error:
Error using ==> inlineeval at 15
Error in inline expression ==> A(2) / (1 + (A(2) / A(1) -1)* exp(A(3)
* t ))
??? Error using ==> mrdivide
Matrix dimensions must agree.

Error in ==> r6 at 6
A = nlinfit(wx,wcdma,myfun,[ 0 ,0 ,0 ]);

原来的方程缺一个点除,即
clear;clc;
wcdma = [1000,1626,3300,4000,5000,6100,12700,16000,23400];
wx = [4.75,5,5.75,6,6.16,6.5,7.5,7.92,8.4];
myfun = inline('A(2)./(1+(A(2)/A(1)-1)*exp(A(3)*t))','A','t');
A = nlinfit(wx,wcdma,myfun,[5000 3000 -0.11])

但是,找不到合适的解。用这个:

clear;clc;
wcdma = [1000,1626,3300,4000,5000,6100,12700,16000,23400];
wx = [4.75,5,5.75,6,6.16,6.5,7.5,7.92,8.4];
myfun = inline('A(1)*exp(A(2)*t)','A','t');
A = nlinfit(wx,wcdma,myfun,[50 1 ]);
t=4:0.1:9;
y=A(1)*exp(A(2)*t);
%a = A(1); b = A(2); c = A(3);
plot(wx,wcdma,'o',t,y)

结果:
A =

52.9143 0.7250