# Bayesian inversion for structural parameter identification (the load varies in each measurement )

Hello,

May I ask a question about how to perform Bayesian inversion in a situation where the measurements are under different load.

In manual ‘BAYESIAN INFERENCE FOR MODEL CALIBRATION AND INVERSE PROBLEMS’. The case study ‘modulus inversion of a beam model’. The number of the experiment is 5, and in each experiment, the load is the same.

%% 2 - FORWARD MODEL (beam)

ModelOpts.mFile = ‘uq_SimplySupportedBeam’;

ModelOpts.isVectorized = true;

myForwardModel = uq_createModel(ModelOpts);

In my case for parameter inversion, the load change with time. The observation data is a vector of N1, and the output of my forward model is a vector of N1 (with N different water load). If I define the output of my forward model as a vector of N1, it can’t work. If only one observation data is used （11），the software can run, but can’t run for the output data of the forward model of (N*1).

I don’t know how to change it to a correct format. Could you help me with it?

MY Case:

%% 2 - FORWARD MODEL (my case)

ModelOpts.mHandle = @(x) uq_disp(x,waterlevel); % calculate the displacement under different water level (the output is N*1)

ModelOpts.isVectorized = true;

myForwardModel = uq_createModel(ModelOpts);

%% 3 - PRIOR DISTRIBUTION OF THE MODEL PARAMETERS

PriorOpts.Marginals(1).Name = ‘E1’; % the elastic modulus

PriorOpts.Marginals(1).Type = ‘Lognormal’;

PriorOpts.Marginals(1).Moments = [30 2];

myPriorDist = uq_createInput(PriorOpts);

%% 4 - MEASUREMENT DATA

myData.y = Data; % the Data is a vector of N*1

Best

Chaoning Lin

1 Like

Hi Chaoning and welcome to UQWorld

You are trying to calibrate a model with N_{\mathrm{out}} outputs using one set of measurements. A similar scenario is described in the Bayesian inversion user manual Section 2.3. The only difference is that you only have one instance of measurements at your disposal (i.e. N=1).

Have a look at the manual and let me know if you managed to solve your problem.

Dear Paul,

I have read Section 2.3 Multiple model output and follow the format, but it still can’t work with multi-output.

The error information is:

Subscripted assignment dimension mismatch.

Error in uq_inversion_likelihood (line 62)

modelRunsCurr(:,ModelIDCurr==jj) = forwardModel(jj).evaluation(:,OutputIDCurrModel);

Maybe there’re some errors in the format of the forward model. The code regarding the forward model is:

The measurements are stored in an 1*Nout matrix.

%% 2 - FORWARD MODEL

ModelOpts.Name = ‘HYMOD Model’;

ModelOpts.mHandle = @(x) uq_disp(x,waterlevel); %calculated the displacement under different water level (the number of water level = Nout).

ModelOpts.isVectorized = true;

myForwardModel = uq_createModel(ModelOpts);

%% 3 - PRIOR DISTRIBUTION OF THE MODEL PARAMETERS

PriorOpts.Name = ‘Prior distribution on parameters’;

PriorOpts.Marginals(1).Name = ‘E1’;

PriorOpts.Marginals(1).Type = ‘Lognormal’;

PriorOpts.Marginals(1).Moments = [30 2];

PriorOpts.Marginals(2).Name = ‘E2’;

PriorOpts.Marginals(2).Type = ‘Lognormal’;

PriorOpts.Marginals(2).Moments = [10 2];

myPriorDist = uq_createInput(PriorOpts);

%% function uq_disp

function V = uq_disp(X,H)

E1=X(1);E2=X(2);

E=[E1,E2];

MaxT=size(H,1);

%output = zeros(2,MaxT);

for tt=1:MaxT

output(:,tt) = dipstatic(E,H(tt,:)); %the function to calculate the displacement

end

V=output; %the output is an 1*Nout matrix

end

Hi Chaoning

So I see a couple of problems with your code:

function V = uq_disp(X,H)

E1=X(1);E2=X(2);
E=[E1,E2];
MaxT=size(H,1);
%output = zeros(2,MaxT);
for tt=1:MaxT
output(:,tt) = dipstatic(E,H(tt,:)); %the function to calculate the displacement
end
V=output; %the output is an 1*Nout matrix

end

1. You specify in the the ModelOpts structure that your model is vectorized, which it clearly is not. Please set ModelOpts.isVectorized = false or modify your function uq_disp to accept vectorized \mathbf{X}
2. Are you sure your output is a 1\times N_{\mathrm{out}} row vector? It looks like it has two rows.

Let me know how it goes!

Hi Paul,
I have changed ModelOpts.isVectorized = false,now it works for my case.
Thank you very much!!