Inverse Problem, I have unknowns to solve it
73 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Abdolrazzagh
il 17 Dic 2025 alle 20:37
Modificato: Torsten
circa 4 ore fa
I can make as many as equation I want with changing Kf, which it will give me A, B, C, D, F equal to the length of Kf, menas you can make it overdetermind
I want to find the values of A1,A2,A3,A4,A5, L and N
clc;
clear;
close all;
K1 = 60;
K2 = 40;
U1 = 30;
U2 = 20;
pt1 = 0;
pt2 = 0.4;
Kf = linspace(1, 3, 3);
Kf1 = 0;
Xl1 = 0.5;
Xl2 = 1-Xl1;
Uf1 = 0;
Uf2 = 0;
phi = Xl1 * pt1 + Xl2 * pt2;
[~,Kub_frame_1,~,Uub_frame_1] = Hashin_Shtrikhman_full(K1,U1,1,pt1,Kf1,Uf1);
[~,Kub_frame_2,~,Uub_frame_2] = Hashin_Shtrikhman_full(K2,U2,1,pt2,Kf1,Uf1);
Y1_Frame = Kub_frame_1 - (2*Uub_frame_1)/3;
Y2_Frame = Kub_frame_2 - (2*Uub_frame_2)/3;
[Cij_A_Frame] = Backus_average([Xl1,Xl2],[Uub_frame_1,Kub_frame_2],[Y1_Frame,Y2_Frame]);
Sij_A_Frame = inv(Cij_A_Frame);
Sig_D = zeros(6, 6, numel(Kf));
for i = 1:numel(Kf)
Kf2 = Kf(i);
[~,Kub_ud_1,~,Uub_ud_1] = Hashin_Shtrikhman_full(K1,U1,1,pt1,Kf2,Uf2);
[~,Kub_ud_2,~,Uub_ud_2] = Hashin_Shtrikhman_full(K2,U2,1,pt2,Kf2,Uf2);
Y1_Sat = Kub_ud_1 - (2*Uub_ud_1)/3;
Y2_Sat = Kub_ud_2 - (2*Uub_ud_2)/3;
[Cij_A_Ud] = Backus_average([Xl1,Xl2],[Uub_ud_1,Uub_ud_2],[Y1_Sat,Y2_Sat]);
Sij_star = inv(Cij_A_Ud);
Sig_D(:,:,i) = Sij_A_Frame - Sij_star;
end
A = squeeze(Sig_D(1,1,:)).';
B = squeeze(Sig_D(1,1,:)).';
C = squeeze(Sig_D(3,3,:)).';
D = squeeze(Sig_D(1,3,:)).';
F = squeeze(Sig_D(4,4,:)).';
kappa_f = 1./Kf;
kappa_a = trace(Sij_A_Frame);
%FinD A1,A2,A3,A4,A5, L and N
A = A1/((kappa_f - L) * phi + (kappa_a - N));
B = A2/((kappa_f - L) * phi + (kappa_a - N));
C = A3/((kappa_f - L) * phi + (kappa_a - N));
D = A4/((kappa_f - L) * phi + (kappa_a - N));
F = A5/((kappa_f - L) * phi + (kappa_a - N));
function [Klb,Kub,Ulb,Uub]=Hashin_Shtrikhman_full(K,U,Vfr,P,Kf,Uf)
Umin=min(U);
Umax=max(U);
Kmin=min(K);
Kmax=max(K);
if P==0
Klb = 1./((1-P).*sum(Vfr./K));
elseif P>0
Klb = 1./((P./Kf)+((1-P).* sum (Vfr./K)));
end
Kub = ((P * (1./(Kf+((4/3)*Umax))) + (1-P) * sum(Vfr./(K+((4/3).*Umax))))^(-1)) - (4/3)*Umax;
Zmax =(Umax/6)*((9*Kmax+8*Umax)/(Kmax+2*Umax));
if P ==0
Zmin =(Umin/6)*((9*Kmin+8*Umin)/(Kmin+2*Umin));
elseif P>0
Zmin =(Uf/6)*((9*Kf+8*Uf)/(Kf+2*Uf));
end
Uub = (( (P/Zmax) + (1-P) * sum (Vfr./(U+Zmax)))^(-1))-Zmax;
Ulb = (( (P/Zmin) + (1-P) * sum (Vfr./(U+Zmin)))^(-1))-Zmin;
end
function [c]=Backus_average(VF,G,Y)
x = sum(VF.*G.*(Y+G)./(Y+2*G));
y = sum(VF.*G.*Y./(Y+2*G));
z = sum(VF.*Y./(Y+2*G));
u = sum(VF./(Y+2*G));
v = sum(VF./G);
w = sum(VF.*G);
A = 4*x + z*z/u;
B = 2*y + z*z/u;
E = 1/u;
F = z/u;
D = 1/v;
M = w;
c = zeros(6,6);
c(1,1) = A;
c(1,2) = B;
c(1,3) = F;
c(2,1) = B;
c(2,2) = A;
c(2,3) = F;
c(3,1) = F;
c(3,2) = F;
c(3,3) = E;
c(4,4) = D;
c(5,5) = D;
c(6,6) = M;
end
0 Commenti
Risposta accettata
Torsten
circa 3 ore fa
Modificato: Torsten
circa 3 ore fa
L and N cannot be estimated separately.
As long as phi is a single scalar value , L*phi + N must be treated as only one parameter that replaces L*phi + N. Otherwise, you do overfitting.
I didn't do that in the code below, but it should be easy for you to modify it accordingly.
clc;
clear;
close all;
K1 = 60;
K2 = 40;
U1 = 30;
U2 = 20;
pt1 = 0;
pt2 = 0.4;
Kf = linspace(1, 3, 3);
Kf1 = 0;
Xl1 = 0.5;
Xl2 = 1-Xl1;
Uf1 = 0;
Uf2 = 0;
phi = Xl1 * pt1 + Xl2 * pt2;
[~,Kub_frame_1,~,Uub_frame_1] = Hashin_Shtrikhman_full(K1,U1,1,pt1,Kf1,Uf1);
[~,Kub_frame_2,~,Uub_frame_2] = Hashin_Shtrikhman_full(K2,U2,1,pt2,Kf1,Uf1);
Y1_Frame = Kub_frame_1 - (2*Uub_frame_1)/3;
Y2_Frame = Kub_frame_2 - (2*Uub_frame_2)/3;
[Cij_A_Frame] = Backus_average([Xl1,Xl2],[Uub_frame_1,Kub_frame_2],[Y1_Frame,Y2_Frame]);
Sij_A_Frame = inv(Cij_A_Frame);
Sig_D = zeros(6, 6, numel(Kf));
for i = 1:numel(Kf)
Kf2 = Kf(i);
[~,Kub_ud_1,~,Uub_ud_1] = Hashin_Shtrikhman_full(K1,U1,1,pt1,Kf2,Uf2);
[~,Kub_ud_2,~,Uub_ud_2] = Hashin_Shtrikhman_full(K2,U2,1,pt2,Kf2,Uf2);
Y1_Sat = Kub_ud_1 - (2*Uub_ud_1)/3;
Y2_Sat = Kub_ud_2 - (2*Uub_ud_2)/3;
[Cij_A_Ud] = Backus_average([Xl1,Xl2],[Uub_ud_1,Uub_ud_2],[Y1_Sat,Y2_Sat]);
Sij_star = inv(Cij_A_Ud);
Sig_D(:,:,i) = Sij_A_Frame - Sij_star;
end
A = squeeze(Sig_D(1,1,:)).';
B = squeeze(Sig_D(1,1,:)).';
C = squeeze(Sig_D(3,3,:)).';
D = squeeze(Sig_D(1,3,:)).';
F = squeeze(Sig_D(4,4,:)).';
kappa_f = 1./Kf;
kappa_a = trace(Sij_A_Frame);
x = [A,B,C,D,F];
y = @(A1,A2,A3,A4,A5,L,N)[A1./((kappa_f - L) * phi + (kappa_a - N)),...
A2./((kappa_f - L) * phi + (kappa_a - N)),...
A3./((kappa_f - L) * phi + (kappa_a - N)),...
A4./((kappa_f - L) * phi + (kappa_a - N)),...
A5./((kappa_f - L) * phi + (kappa_a - N))];
fy = @(p)y(p(1),p(2),p(3),p(4),p(5),p(6),p(7));
F = @(p) fy(p) - x;
sol = lsqnonlin(F,[7 6 5 4 3 2 1])
%FinD A1,A2,A3,A4,A5, L and N
%A = A1/((kappa_f - L) * phi + (kappa_a - N));
%B = A2/((kappa_f - L) * phi + (kappa_a - N));
%C = A3/((kappa_f - L) * phi + (kappa_a - N));
%D = A4/((kappa_f - L) * phi + (kappa_a - N));
%F = A5/((kappa_f - L) * phi + (kappa_a - N));
function [Klb,Kub,Ulb,Uub]=Hashin_Shtrikhman_full(K,U,Vfr,P,Kf,Uf)
Umin=min(U);
Umax=max(U);
Kmin=min(K);
Kmax=max(K);
if P==0
Klb = 1./((1-P).*sum(Vfr./K));
elseif P>0
Klb = 1./((P./Kf)+((1-P).* sum (Vfr./K)));
end
Kub = ((P * (1./(Kf+((4/3)*Umax))) + (1-P) * sum(Vfr./(K+((4/3).*Umax))))^(-1)) - (4/3)*Umax;
Zmax =(Umax/6)*((9*Kmax+8*Umax)/(Kmax+2*Umax));
if P ==0
Zmin =(Umin/6)*((9*Kmin+8*Umin)/(Kmin+2*Umin));
elseif P>0
Zmin =(Uf/6)*((9*Kf+8*Uf)/(Kf+2*Uf));
end
Uub = (( (P/Zmax) + (1-P) * sum (Vfr./(U+Zmax)))^(-1))-Zmax;
Ulb = (( (P/Zmin) + (1-P) * sum (Vfr./(U+Zmin)))^(-1))-Zmin;
end
function [c]=Backus_average(VF,G,Y)
x = sum(VF.*G.*(Y+G)./(Y+2*G));
y = sum(VF.*G.*Y./(Y+2*G));
z = sum(VF.*Y./(Y+2*G));
u = sum(VF./(Y+2*G));
v = sum(VF./G);
w = sum(VF.*G);
A = 4*x + z*z/u;
B = 2*y + z*z/u;
E = 1/u;
F = z/u;
D = 1/v;
M = w;
c = zeros(6,6);
c(1,1) = A;
c(1,2) = B;
c(1,3) = F;
c(2,1) = B;
c(2,2) = A;
c(2,3) = F;
c(3,1) = F;
c(3,2) = F;
c(3,3) = E;
c(4,4) = D;
c(5,5) = D;
c(6,6) = M;
end
4 Commenti
Torsten
circa 3 ore fa
Modificato: Torsten
circa 3 ore fa
Every combination of L and N that makes LN = L*phi + N solves the fitting task. You must consider L*phi + N as one constant as long as phi is a constant that is equally valid for A, B, C, D and F.
"lsqnonlin" is especially suited for least-squares problems - that's why I chose it. If you want to set constraints on the parameters, you will have to use "fmincon" instead.
Più risposte (2)
Walter Roberson
il 17 Dic 2025 alle 21:55
A = squeeze(Sig_D(1,1,:)).';
B = squeeze(Sig_D(1,1,:)).';
C = squeeze(Sig_D(3,3,:)).';
D = squeeze(Sig_D(1,3,:)).';
F = squeeze(Sig_D(4,4,:)).';
each of those is a row vector with the same number of elements as Kf has
%FinD A1,A2,A3,A4,A5, L and N
A = A1/((kappa_f - L) * phi + (kappa_a - N));
B = A2/((kappa_f - L) * phi + (kappa_a - N));
C = A3/((kappa_f - L) * phi + (kappa_a - N));
D = A4/((kappa_f - L) * phi + (kappa_a - N));
F = A5/((kappa_f - L) * phi + (kappa_a - N));
In each case, A, B, C, D, F are known, but A1, A2, A3, A4, A5, L and N are unknown. These should instead be equations expressing that the left hand side is equal to the right hand side.
Notice though that the right hand sides all involve division by the same factor. So if you were to do something like
TEMP = ((kappa_f - L) * phi + (kappa_a - N));
then you would have
A == A1/TEMP
B == A2/TEMP
C == A3/TEMP
D == A4/TEMP
F == A5/TEMP
At this point we need to pause and ask whether the / operator is really the one intended, or if instead the ./ operator is intended, which in turn revolves around the expected size of TEMP and the expected size of A1 and so on.
We see that TEMP is constructed in part from kappa_f and kappa_f is constructed from 1./Kf and Kf is a row vector -- so kappa_f is a row vector and so TEMP must be a row vector. The A B etc. are all row vectors, so we have row_vector == UNKNOWN / row_vector . Experimentally, scalar / row_vector fails, and row_vector / row_vector yields a scalar rather than a row vector, so we deduce that the stated / operations must have been intended to be ./ operations. Unfortunately, we still cannot deduce whether the operation is row_vector == scalar ./ row_vector or if it is row_vector == row_vector ./ row_vector. However, if we rearrange to row_vector .* TEMP where TEMP is a row vector, then we can see that the result must be a row vector. This leads to
A1 = A .* TEMP;
A2 = B .* TEMP;
A3 = C .* TEMP;
A4 = D .* TEMP;
A5 = F .* TEMP;
Now we have a problem: TEMP is defined in terms of the underfined variables L and N, There are 5(*3) equations in 5(*3) unknowns excluding L and N... so there just are not equations to be able to deduce L or N. There is also not enough information to be able to deduce the expected size of L and N.
So... the system is not solvable.
9 Commenti
Vedere anche
Categorie
Scopri di più su Large Files and Big Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!