Solving misfit using both L1 and L2 norm
Mostrar comentarios más antiguos
Hi,
I have observed data and a vector "Pmodel ", which I am calculating following one equation. Now I need to have L1 norm and L2-norm solution of the difference between the observed and calculated parameter. Below, I followed the logic. Am I correct in this sense, kindly suggest.
----------------------------------------------
for i=1:length(s)
for j=1:length(h)
P_Model=C-(2.*v.*m_h(j))-(m_s(i).*log(v)); %Model
P_Obs=data(:,1);
Error(i,j)=sqrt(sum( sum( ((P_Model-P_Obs)).^2 ) )) %misfit calculation with L2 norm
Error(i,j)=sum(abs(P_Model-P_Obs)) %misfit calculation with L1 norm
end
end
------------------------------------------------------------------------------------------------------------------
Answer will be highly appreciated. Kindly suggest alternative if this is not correct apporach.
Thanking you in anticipation.
6 comentarios
Torsten
el 21 de Jun. de 2022
Since we don't know size and meaning of the variables involved, we cannot tell whether your code is correct.
But since P_Model seems to be a scalar and P_observed is a column vector, I guess no.
Rock Interpreter
el 21 de Jun. de 2022
Rock Interpreter
el 21 de Jun. de 2022
Torsten
el 21 de Jun. de 2022
Why do you get Error(i,j) ? What is s ? What is h ? What is the loop intended to do - calculate the error after parameter fitting ?
Please explain in more detail.
Rock Interpreter
el 21 de Jun. de 2022
Torsten
el 21 de Jun. de 2022
Instead of searching for optimal s and h in a loop, use lsqcurvefit to fit your parameters (and minimize the error).
Respuestas (0)
Categorías
Más información sobre Quadratic Programming and Cone Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
