help-octave
[Top][All Lists]
Advanced

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

fminunc and for loop


From: Michael Teitelbaum
Subject: fminunc and for loop
Date: Tue, 10 Jul 2012 13:23:28 -0400

Hi,
I am trying to perform the fminunc function, but I want to use a for loop within my function, and I'm not sure exactly how to do that.
What I want is:

fminunc(f,[0,0])
where f equals the sum of:

f = @(x)((((A(i,3) / 1000 + x(1) + A(i,4) / 1000 - ((A(i,3) / 1000 + x(1) + A(i,4) / 1000) ^ 2 - 4 * A(i,3) / 1000 * A(i,4) / 1000) ^ 0.5) / 2 * 1.4e-3 - (1.4e-3 - 8e-6) * (A(i-1,3) / 1000 + x(1) + A(i-1,4) / 1000 - ((A(i-1,3) / 1000 + x(1) + A(i-1,4) / 1000) ^ 2 - 4 * A(i-1,3) / 1000 * A(i-1,4) / 1000) ^ 0.5) / 2) * x(2)) * 1e6 - A(i,1)) ^ 2

for i between 5 and  35.

If it is not possible to use a for loop within fminunc, is there a good way to get octave to write out that function for me instead of me having to write it out manually?

Any help would be greatly appreciated.
Thanks,
Michael

reply via email to

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