Problem using function fsolve
Ältere Kommentare anzeigen
Hello!
I'm trying to run a code with function fsolve.
T = 295.15;
p_a = 101.3;
x_0 = 0.07;
x_0_t = 0.05;
s_2 = 0.0225;
s_1 = 0.18;
d = 24.3e-3;
T = 295.15;
p_a = 101.3;
x_0 = 0.07;
x_0_t = 0.05;
s_2 = 0.0225;
s_1 = 0.18;
d = 24.3e-3;
rho_0=1.186
p_0=101.325;
c_0=343.2*sqrt(T/293);
Z_0 = rho_0*c_0;
Trennfrequenz=762;
load ('E:\Masterprojekt\Messdaten\Absorp+TransmissGreiner_RG25_20mm_offen')
M=real(Absorp_TransmissGreiner_RG2(1:100, 1:6));
F_=real(Absorp_TransmissGreiner_RG2_X(1:100));
lambda_0=c_0./F_;
rho=rho_0*p_a*T_0/(p_0*T);
k_0= 2*pi./lambda_0+sqrt(F_).*(1.94e-2/(c_0*d));
P_1=M(:,5);
P_3=M(:,2);
P_4=M(:,3);
P_6=M(:,6);
H_13=P_3./P_1;
H_46=P_6./P_4;
R_lp = (exp(k_0.*1i.*(x_0))-H_13.*exp(k_0.*1i.*(x_0+s_1)))./(exp(k_0.*(-1i).*x_0)-H_13.*exp(k_0.*(-1i).*(x_0+s_1)));
R_la = (exp(k_0.*1i.*(x_0_t))-H_46.*exp(k_0.*1i.*(x_0_t+s_1)))./(exp(k_0.*(-1i).*x_0_t)-H_13.*exp(k_0.*(-1i).*(x_0_t+s_1)));
Z_l_I = Z_0*(1+R_lp)./(1-R_lp);
Z_a_I = Z_0*(1+R_la)./(1-R_la);
load ('E:\Masterprojekt\Messdaten\Absorp+TransmissGreiner_RG25_20mm_schallhart')
M_II=real(Absorp_TransmissGreiner_RG2(1:100, 1:6));
P_1_II=M_II(:,5);
P_3_II=M_II(:,2);
P_4_II=M_II(:,3);
P_6_II=M_II(:,6);
H_13_II=P_3_II./P_1_II;
H_46_II=P_6_II./P_4_II;
R_lp_II = (exp(k_0.*1i.*(x_0))-H_13_II.*exp(k_0.*1i.*(x_0+s_1)))./(exp(k_0.*(-1i).*x_0)-H_13_II.*exp(k_0.*(-1i).*(x_0+s_1)));
R_la_II = (exp(k_0.*1i.*(x_0_t))-H_46_II.*exp(k_0.*1i.*(x_0_t+s_1)))./(exp(k_0.*(-1i).*x_0_t)-H_13_II.*exp(k_0.*(-1i).*(x_0_t+s_1)));
Z_l_II = Z_0*(1+R_lp_II)./(1-R_lp_II);
Z_a_II = Z_0*(1+R_la_II)./(1-R_la_II);
load ('E:\Masterprojekt\Messdaten\Absorp+TransmissGreiner_RG25_20mm_Mit_Schaumstoff')
M_III=real(Absorp_TransmissGreiner_RG2(1:100, 1:6));
P_1_III=M_III(:,5);
P_3_III=M_III(:,2);
P_4_III=M_III(:,3);
P_6_III=M_III(:,6);
H_13_III=P_3_III./P_1_III;
H_46_III=P_6_III./P_4_III;
R_lp_III = (exp(k_0.*1i.*(x_0))-H_13_III.*exp(k_0.*1i.*(x_0+s_1)))./(exp(k_0.*(-1i).*x_0)-H_13_III.*exp(k_0.*(-1i).*(x_0+s_1)));
R_la_III = (exp(k_0.*1i.*(x_0_t))-H_46_III.*exp(k_0.*1i.*(x_0_t+s_1)))./(exp(k_0.*(-1i).*x_0_t)-H_13_III.*exp(k_0.*(-1i).*(x_0_t+s_1)));
Z_l_III = Z_0*(1+R_lp_III)./(1-R_lp_III);
Z_a_III = Z_0*(1+R_la_III)./(1-R_la_III);
z0 = [0;0;0];
F = @(z) [z(1)+(z(2)+T_0+Z_a_I)*z(3)/(z(2)+z(3)+T_0+Z_a_I)-Z_l_I;
z(1)+(z(2)+T_0+Z_a_II)*z(3)/(z(2)+z(3)+T_0+Z_a_II)-Z_l_II;
z(1)+(z(2)+T_0+Z_a_III)*z(3)/(z(2)+z(3)+T_0+Z_a_III)-Z_l_III];
z = fsolve(F,z0);
Z_1 = z(1,1);
Z_2 = z(1,2);
Z_3 = z(1,3);
...
And getting following errors (in Attachment as well):
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using
Levenberg-Marquardt algorithm instead.
> In fsolve (line 310)
In Absorptionsgrad_nach_Boonen_tiefe_Frequenz_korrigiert_1 (line 100)
Error using levenbergMarquardt (line 16)
Objective function is returning undefined values at initial point. fsolve cannot continue.
Error in fsolve (line 417)
levenbergMarquardt(funfcn,x,verbosity,options,defaultopt,f,JAC,caller, ...
Error in Absorptionsgrad_nach_Boonen_tiefe_Frequenz_korrigiert_1 (line 100)
z = fsolve(F,z0);
Akzeptierte Antwort
Weitere Antworten (1)
Vladyslav Toporin
am 16 Jan. 2020
1 Kommentar
Star Strider
am 16 Jan. 2020
Bearbeitet: Star Strider
am 16 Jan. 2020
As always, my pleasure!
This is far from my areas of expertise. However I may understand enough of it to suggest a reasonable approach to estimating the parameters (assuming I understand the parameters that need to be estimated).
EDIT — (16 Jan 2020 at 21:15)
It is theoretically possible to estimate the ‘A’, ‘B’, ‘C’, ‘D’ and ‘Z_0’ parameters in Eq 5. However, I need to know (1) if that is what you want to do, and (2) what the data files represent with respect to the diagram that accompanies Eq 5 (that I believe is Fig. 2).
I know essentially nothing about what you want to do. I will help as I can, however just now I do not know what the data files represent or what parameters you want to estimate, or what model you want to use to estimate them.
Kategorien
Mehr zu Direction of Arrival Estimation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
