why do i got this error?

4 views (last 30 days)
RADWAN A F ZEYADI
RADWAN A F ZEYADI on 22 Nov 2021
Commented: Image Analyst on 25 Nov 2021
Unable to perform assignment because the size of the left side is 153-by-1 and the size of the right side is 51-by-1-by-3.
d =calc(Vp,Vs,Rh,wavelet,ang);
when i want to perfurm for loop i hane got this error knowing that the calc is function give output 3darray
  15 Comments
Image Analyst
Image Analyst on 25 Nov 2021
OK, I've downloaded them all, so edit your post and delete one attachment like it says, and upload the mat file.
RADWAN A F ZEYADI
RADWAN A F ZEYADI on 25 Nov 2021
i have upload it,

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 22 Nov 2021
You can try
t = calc(Vp,Vs,Rh,wavelet,ang) % t should by 51x1x3.
% Squeeze to get a 51x3
t = squeeze(t); % A 51c3
whos t
d = t(:, 1); % Take column 1 of t and put it into d

Image Analyst
Image Analyst on 25 Nov 2021
I don't know exactly what you're doing but look at this:
function [updatemodel, k_gain] = ESMDA_inversion(w, data, d_pred, alfa, Cd)
[nd, ne] = size(d_pred);
% data perturbation
term1 = repmat(data,1,ne);
term2 = sqrt(alfa*Cd);
term3 = randn(nd, ne);
term4 = term2 * term3;
whos data
whos term1
whos term2
whos term3
whos term4
dpert=repmat(data,1,ne) + sqrt(alfa*Cd)*randn(nd, ne);
% mean models
mm = mean(w, 2);
md = mean(d_pred, 2);
% covariance matrices
cmd = 1/(ne-1) * (w - mm) * (d_pred - md)';
cdd = 1/(ne-1) *(d_pred - md) * (d_pred - md)';
% Kalman Gain
k_gain = cmd * inv(cdd + alfa*Cd);
% Updated models
updatemodel = w + k_gain*(dpert - d_pred);
end
If you run that you'll see
Name Size Bytes Class Attributes
data 51x3 612 single
Name Size Bytes Class Attributes
term1 51x1500 306000 single
Name Size Bytes Class Attributes
term2 153x153 93636 single
Name Size Bytes Class Attributes
term3 153x500 612000 double
Name Size Bytes Class Attributes
term4 153x500 306000 single
and you're trying to add term4 to term1. But you cannot add a 153 row matrix to a 51 row matrix. To add matrices they must have the same number of rows and columns. Examine the logic of your program and try to figure out what you really want to do.
  3 Comments
RADWAN A F ZEYADI
RADWAN A F ZEYADI on 25 Nov 2021
whos
Name Size Bytes Class Attributes
Cd 153x153 93636 single
Cm 153x153 187272 double
DX 1x1 8 double
DY 1x1 8 double
M 1x1 8 double
N 1x1 8 double
NI_TAU_Y 51x51 20808 double
Phi 51x500 102000 single
Phi_sim 51x500 204000 double
Phi_sim_logit 51x500 204000 double
Phi_true 51x71 28968 double
Phi_true_logit 51x71 28968 double
Phimean 51x1 204 single
Phiup 51x500 102000 single
Rho_true 51x71 28968 double
Rhosim 51x500 204000 double
Rhoup 51x500 204000 double
Sh 51x500 102000 single
Sh_sim 51x500 204000 double
Sh_sim_logit 51x500 204000 double
Sh_true 51x71 28968 double
Sh_true_logit 51x71 28968 double
Shup 51x500 102000 single
Sw 51x500 102000 single
Sw_sim 51x500 204000 double
Sw_sim_logit 51x500 204000 double
Sw_true 51x71 28968 double
Sw_true_logit 51x71 28968 double
Swmean 51x1 204 single
Swup 51x500 102000 single
Vp_true 51x71 28968 double
Vpsim 51x500 408000 double complex
Vpup 51x500 408000 double complex
Vs_true 51x71 28968 double
Vssim 51x500 408000 double complex
Vsup 51x500 408000 double complex
a 1x1 8 double
alfa 1x1 8 double
ang 1x3 24 double
b 1x1 8 double
c 1x1 8 double
cdd 153x153 93636 single
cmd 153x153 93636 single
cov_logit 3x3 72 double
d 1x1 8 double
d_obs 51x71x3 43452 single
d_obs_noise 51x71x3 43452 single
d_pred 153x500 306000 single
data 153x1 612 single
dpert 153x500 306000 single
dt 1x1 8 double
far 51x1 204 single
farp 51x500 102000 single
iter 1x1 8 double
j 1x1 8 double
k_gain 153x153 93636 single
m_sim 153x500 612000 double
md 153x1 612 single
mean_logit 153x1 1224 double
mid 51x1 204 single
midp 51x500 102000 single
mm 153x1 1224 double
mpost 153x1 612 single
nang 1x1 8 double
nd 1x1 8 double
ne 1x1 8 double
near 51x1 204 single
nearp 51x500 102000 single
ni_tau_y 1x101 808 double
shmean 51x1 204 single
std_noise 1x1 4 single
tau_y 1x101 808 double
updatemodel 153x500 306000 single
w 153x500 612000 double
wavelet 1x61 488 double
well_log_phi 51x3 1224 double
well_log_sh 51x3 1224 double
well_log_sw 51x3 1224 double
wup 153x500 306000 single
xax 1x201 1608 double
yax 1x51 408 double
Image Analyst
Image Analyst on 25 Nov 2021
OK but my answer stands. I put a breakpoint on the line where it tried to add two differently shaped matrices. You need to fix that.

Sign in to comment.

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!