Questions about de_min in octave

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about de_min in octave

denizyazgac
1- I have a function with 3 parameters  [x(1),x(2),x(3)] and I try to solve
minimum of that function and try to get optimal  [x(1),x(2),x(3)]
I know the upper and lower bound of that parameters but there shoud be also
some constrains like x(3)=>x(2)
I can not define that constrain and solution shows me x(2)>x(3) sometime.
How can I implement  x(3)=>x(2) for all possible iteration of de_min.

2-Sometimes convergence parameter shows 0 but "optimal" parameters out of
bound.

Thanks



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

Doug Stewart-4

On Thu, Sep 28, 2017 at 3:34 AM, denizyazgac <[hidden email]> wrote:
1- I have a function with 3 parameters  [x(1),x(2),x(3)] and I try to solve
minimum of that function and try to get optimal  [x(1),x(2),x(3)]
I know the upper and lower bound of that parameters but there shoud be also
some constrains like x(3)=>x(2)
I can not define that constrain and solution shows me x(2)>x(3) sometime.
How can I implement  x(3)=>x(2) for all possible iteration of de_min.

2-Sometimes convergence parameter shows 0 but "optimal" parameters out of
bound.

Thanks



_

Can you show us the function?


--
DAS


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

NJank
In reply to this post by denizyazgac


On Thu, Sep 28, 2017 at 3:34 AM, denizyazgac <[hidden email]> wrote:
1- I have a function with 3 parameters

without any details of the functions you're using or have written, it's impossible for us to help.

Octave has an optimization package that may do some of the tasks you want. link to the function list below.  the functions should define how to provide variables, constraints, etc.
https://octave.sourceforge.io/optim/overview.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

denizyazgac
This post was updated on .
Sorry;
I try to make a back calculation with using Johnson Champoux Allard
mathematical model, which defines acoustic impedance behaviour of acoustic
foams.
f,RRR,III vectors are measured data(frequency,real and imaginer parts) from
impedance tube (they are surface impedance), I try to obtain some critical
parameters like tortousity,char. viscous and thermal length from this data
with de_min function.

<http://octave.1599824.n4.nabble.com/file/t372543/back_calc_2.m


#back_calclation for porous samples
clc
clear all
pkg load optim
gamma=1.401 # specific heat ratio
P0=99700 #pressure
eta= 1.56E-5; #dynamic viscosity
B=0.707 # Prandtl number
fi=0.95 # porosity    
L=34.35/1000 #thickness
rho0=1.2 #air density
sigma=8197# air resistivity
c=340;# sound speed

f=[202.53
300.94
399.35
502.52
599.34
704.10
800.92
897.74
1002.50
1100.91
1204.09
1305.67
1404.09
1500.92
1604.09];

RRR=[0.731942065
0.701451715
0.641506283
0.596238299
0.580492187
0.535207505
0.504733852
0.48898774
0.473158139
0.457395329
0.471037507
0.469968842
0.468933572
0.497370082
0.496284719];

III=[-6.057454106
-4.070271408
-3.040378842
-2.422907504
-2.011571639
-1.688601017
-1.409863111
-1.219406958
-1.014356847
-0.868083316
-0.721893274
-0.590363981
-0.458884781
-0.312678041
-0.225364765];

w=2.*pi.*f(4); %f(4) can be change between f(1)....f(15) with length of f
vector.

#effective density
edn= @(x)  rho0.*x(1).*(1+ ( (fi.*sigma./(j.*w.*rho0.*x(1))).*sqrt(1+
(j.*(4.*w.*rho0.*eta.*(x(1).^2))./(sigma.^2.*fi.^2.*x(2).^2)))));
#effective bulk modulus
ebm= @(x) (gamma.*P0)./
(gamma-((gamma-1).*(1+(8.*eta./(j.*w.*B.*(x(3).^2).*rho0)).*sqrt(1+(j.*(w.*B.*rho0.*(x(3).^2))./(16.*eta)))).^(-1)));
#complex wave number
kwave= @(x) (w.*sqrt(edn(x)./ebm(x)));
#char impedance back_calc_2.m

ZC=@(x) sqrt(edn(x).*ebm(x));
#general function x(1) tortuosity,x(2) viscous characteristic length,x(3)
thermal characteristic length
ZS=@(x) ((-j.*ZC(x).*cot(kwave(x).*L))./(fi.*rho0.*c));
optim=@(x) abs(RRR(4)+i.*III(4)-ZC(x));

ctl.XVmin = [1 0 0];
ctl.XVmax = [4 1 1];
# note to forumers: as a result of theory x(3)>x(2) but I can not define in
ctl structure
[x, obj_value, nfeval, convergence] = de_min (optim, ctl)





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
Help-octave@gnu.org
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

denizyazgac
EDIT
Please forget previous one

Sorry;
I try to make a back calculation with using Johnson Champoux Allard
mathematical model, which defines acoustic impedance behaviour of acoustic
foams.
f,RRR,III vectors are measured data(frequency,real and imaginer parts) from
impedance tube (they are surface impedance), I try to obtain some critical
parameters like tortousity,char. viscous and thermal length from this data
with de_min function.

<http://octave.1599824.n4.nabble.com/file/t372543/back_calc_2.m>  


#back_calclation for porous samples
clc
clear all
pkg load optim
gamma=1.401 # specific heat ratio
P0=99700 #pressure
eta= 1.56E-5; #dynamic viscosity
B=0.707 # Prandtl number
fi=0.95 # porosity    
L=34.35/1000 #thickness
rho0=1.2 #air density
sigma=8197# air resistivity
c=340;# sound speed

f=[202.53
300.94
399.35
502.52
599.34
704.10
800.92
897.74
1002.50
1100.91
1204.09
1305.67
1404.09
1500.92
1604.09];

RRR=[0.731942065
0.701451715
0.641506283
0.596238299
0.580492187
0.535207505
0.504733852
0.48898774
0.473158139
0.457395329
0.471037507
0.469968842
0.468933572
0.497370082
0.496284719];

III=[-6.057454106
-4.070271408
-3.040378842
-2.422907504
-2.011571639
-1.688601017
-1.409863111
-1.219406958
-1.014356847
-0.868083316
-0.721893274
-0.590363981
-0.458884781
-0.312678041
-0.225364765];

w=2.*pi.*f(4); %f(4) can be change between f(1)....f(15) with length of f
vector.

#effective density
edn= @(x)  rho0.*x(1).*(1+ ( (fi.*sigma./(j.*w.*rho0.*x(1))).*sqrt(1+
(j.*(4.*w.*rho0.*eta.*(x(1).^2))./(sigma.^2.*fi.^2.*x(2).^2)))));
#effective bulk modulus
ebm= @(x) (gamma.*P0)./
(gamma-((gamma-1).*(1+(8.*eta./(j.*w.*B.*(x(3).^2).*rho0)).*sqrt(1+(j.*(w.*B.*rho0.*(x(3).^2))./(16.*eta)))).^(-1)));
#complex wave number
kwave= @(x) (w.*sqrt(edn(x)./ebm(x)));
#char impedance back_calc_2.m

ZC=@(x) sqrt(edn(x).*ebm(x));
#general function x(1) tortuosity,x(2) viscous characteristic length,x(3)
thermal characteristic length
ZS=@(x) ((-j.*ZC(x).*cot(kwave(x).*L))./(fi.*rho0.*c));
optim=@(x) abs(RRR(4)+i.*III(4)-ZC(x));

ctl.XVmin = [1 0 0];
ctl.XVmax = [4 1 1];
# note to forumers: as a result of theory x(3)>x(2) but I can not define in
ctl structure
[x, obj_value, nfeval, convergence] = de_min (optim, ctl)





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

Doug Stewart-4


On Thu, Sep 28, 2017 at 10:18 AM, denizyazgac <[hidden email]> wrote:
EDIT
Please forget previous one

Sorry;
I try to make a back calculation with using Johnson Champoux Allard
mathematical model, which defines acoustic impedance behaviour of acoustic
foams.
f,RRR,III vectors are measured data(frequency,real and imaginer parts) from
impedance tube (they are surface impedance), I try to obtain some critical
parameters like tortousity,char. viscous and thermal length from this data
with de_min function.

<http://octave.1599824.n4.nabble.com/file/t372543/back_calc_2.m>


#back_calclation for porous samples
clc
clear all
pkg load optim
gamma=1.401 # specific heat ratio
P0=99700 #pressure
eta= 1.56E-5; #dynamic viscosity
B=0.707 # Prandtl number
fi=0.95 # porosity
L=34.35/1000 #thickness
rho0=1.2 #air density
sigma=8197# air resistivity
c=340;# sound speed

f=[202.53
300.94
399.35
502.52
599.34
704.10
800.92
897.74
1002.50
1100.91
1204.09
1305.67
1404.09
1500.92
1604.09];

RRR=[0.731942065
0.701451715
0.641506283
0.596238299
0.580492187
0.535207505
0.504733852
0.48898774
0.473158139
0.457395329
0.471037507
0.469968842
0.468933572
0.497370082
0.496284719];

III=[-6.057454106
-4.070271408
-3.040378842
-2.422907504
-2.011571639
-1.688601017
-1.409863111
-1.219406958
-1.014356847
-0.868083316
-0.721893274
-0.590363981
-0.458884781
-0.312678041
-0.225364765];

w=2.*pi.*f(4); %f(4) can be change between f(1)....f(15) with length of f
vector.

#effective density
edn= @(x)  rho0.*x(1).*(1+ ( (fi.*sigma./(j.*w.*rho0.*x(1))).*sqrt(1+
(j.*(4.*w.*rho0.*eta.*(x(1).^2))./(sigma.^2.*fi.^2.*x(2).^2)))));
#effective bulk modulus
ebm= @(x) (gamma.*P0)./
(gamma-((gamma-1).*(1+(8.*eta./(j.*w.*B.*(x(3).^2).*rho0)).*sqrt(1+(j.*(w.*B.*rho0.*(x(3).^2))./(16.*eta)))).^(-1)));
#complex wave number
kwave= @(x) (w.*sqrt(edn(x)./ebm(x)));
#char impedance back_calc_2.m

ZC=@(x) sqrt(edn(x).*ebm(x));
#general function x(1) tortuosity,x(2) viscous characteristic length,x(3)
thermal characteristic length
ZS=@(x) ((-j.*ZC(x).*cot(kwave(x).*L))./(fi.*rho0.*c));
optim=@(x) abs(RRR(4)+i.*III(4)-ZC(x));

ctl.XVmin = [1 0 0];
ctl.XVmax = [4 1 1];
# note to forumers: as a result of theory x(3)>x(2) but I can not define in
ctl structure
[x, obj_value, nfeval, convergence] = de_min (optim, ctl)





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave





I had to modify line 70 to

ZC=@(x) sqrt(edn(x,w).*ebm(x,w));



and then I got this answer for x:
 -4.2643e-03  -1.1294e+00  -3.0383e-06 

and x(3) is more positive than x(2)  ie. x(3) >x(2)
I do not know what these numbers mean. Is this what you got?

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Questions about de_min in octave

denizyazgac
This post has NOT been accepted by the mailing list yet.
Please consider the code which is pasted on massege  to last post. ( function should only coupled with x1 x2 x3 not w.)
please do not use attached code.
 
Problem for me is İ can not define a relationship between x2 and x3.
İf optimisation ends up with x2>x3 thats wrong solution.