help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## Re: Help in parameter estimation

 From: Bharath R Subject: Re: Help in parameter estimation Date: Tue, 30 Aug 2016 17:10:48 +0200

Hi Nicholas,

here it is>

x =
19.54533     0.00000    21.33717     0.00000     0.60320
19.30000     0.00000    21.28817     0.00000     0.66134
19.30000     0.00000    20.55900     0.00000     0.71948
19.13750     0.00000    21.21883     0.00000     0.77762
19.00000     0.00000    20.68650     0.00000     0.83576

Thanks

On Tue, Aug 30, 2016 at 4:52 PM, Nicholas Jankowski wrote:
On Tue, Aug 30, 2016 at 10:45 AM, Bharath R wrote:
Hi Nicholas,

Thanks for the mail. I am sorry that I have used mat earlier, now I changed the function as follows:

function F=f(x,p)
A=xlsread('OGparameters.xlsx');
x=[A(:,3),A(:,5),A(:,2),A(:,6),A(:,7)];
p(1)=20;
p(2)=1;
p(3)=100;
p(4)=1;
p(5)=0.001;
p(6)=1;
p(7)=0.01;
typeinfo(x)
pin=[p(1);p(2);p(3);p(4);p(5);p(6);p(7)];
m(1,1)=20;
for i=1:length(x)
m(i+1,1)=((p(1)-m(i,1))/(p(2)*p(3))+((p(4)*x(i,2)*(x(i,3)-m(i,1)))+(p(5)*x(i,4))+(p(6)*x(i,5)))/(p(3))+p(7))+m(i,1);
endfor
F=m(2:end);
endfunction

I am generating a matrix of [length(x), 1] as output from the function. My measured value is also a matrix of [length(x), 1].

What I would like to do now is to estimate parameters p.  I am using the following command to run the optimization program ( I have tried with nonlinear curve fit as well):

[L,p,cvg,iter]=leasqr(x,y,pin,f)

pin ,x and y are  initialized. The problem is when I run the optimization algorithm, it throws me the following error:

error: leasqr: subscript indices must be either positive integers less than 2^31 or logicals
error: called from
leasqr at line 329 column 9

I look forward to your reply.

Regards,
Bharath

On Tue, Aug 30, 2016 at 4:01 PM, Nicholas Jankowski wrote:
On Tue, Aug 30, 2016 at 6:00 AM, Bharath R wrote:

function m=f(x,p)
m(1,:)=20;
for i=1:length(x)
m(i+1,:)=((p(1)-m(i,:))/(p(2)*p(3))+((p(4)*x(i,2)*(x(i,3)-m(i,:)))+(p(5)*x(i,4))+(p(6)*x(i,5)))/(p(3))+p(7))+m(i,:);
endfor
mat=m(2:end);
endfunction

is your intent to return the variable m or the variable mat from function f? you are currently returning m and never using mat. since mat is a different size than m, this could make a significant difference when you use the results of f later.

your declaration for m is odd. it asks to make all of the columns in row1 equal to 20.  since m has not yet been initialized, the number of rows is 1. so the output is a 1x1 array, or a scalar, and m = 20. then in the for loop, if the result of the m(i+1,:) equation was 6, you would be appending it as a new row to m, creating a 2x1 array [20 ; 6] . Since you went to the trouble of using the : operator, but have it doing nothing, I suspect this was not your intent?

Can you provide a small sample that I can use for values of x?

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]