2

Can anyone explain to me how I can apply non linear regression to this equation t find out K using the matlab command window.

I = 10^-9(exp(38.68V/k)-1). Screenshot of Equation

I have data values as follows:

Voltage := [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]:
Current:= [0, 0, 0, 0, 0, 0, 0, 0.07, 0.92, 12.02, 158.29]:

Screenshot of Equation

[NEW]: Now I used FminSearch as an alternative another and another error message appeared.

Matrix dimensions must agree.

Error in @(k)sum((I(:)-Imodel(V(:),k)).^2)

Error in fminsearch (line 189)
fv(:,1) = funfcn(x,varargin{:});

I used this fminsearch code:

>> V = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0];
>> I = [0, 0, 0, 0, 0, 0, 0.07 ,0.92 ,12.02 ,158.29];
>> Imodel = @(V,k) 1E-9*(exp(38.68*V/k)-1);
>> k0 = 1;
>> kmodel = fminsearch(@(k) sum((I(:)-Imodel(V(:),k)).^2), k0)    
>> kmodel = fminsearch(@(k) sum((I(:)-Imodel(V(:),k)).^2), k0);
4

1 回答 1

5

给定电流数据和电压数据作为向量,您想找到k将指数模型的平方误差和最小化的参数(顺便说一句,这是电流/电压特性吗?) :IV

Imodel = @(V,k) 1E-9*(exp(38.68*V/k)-1);
k0     = 1;
kmodel = fminsearch(@(k) sum((I(:)-Imodel(V(:),k)).^2), k0);

plot(V(:), I(:), 'ok', V(:), Imodel(V(:),kmodel), '-r');

匿名函数计算误差平方和。将最小化模型误差的参数的搜索k从值 1 开始;请将其更改为更合适的值(如果您对此有很好的猜测)。

于 2016-02-12T12:13:59.563 回答