MATLAB Answers

0

Filling in matrix for strain map

Asked by Yoni de Jong on 12 Jun 2019
Latest activity Answered by Yoni de Jong on 12 Jun 2019
Accepted Answer by KSSV
Hi Guys,
How can I fill in the elements in the matrix so that it is equally distributed, based on a few already filled in elements? For example
[0 0 0 0 4 0 0 0 0
0 0 0 0 3 0 0 0 0
0 0 0 0 2 0 0 0 0
0 0 0 0 1 0 0 0 0
7 4 3 2 0 1 2 3 7
0 0 0 0 2 0 0 0 0
0 0 0 0 4 0 0 0 0
0 0 0 0 5 0 0 0 0]
Now i want to become all zeros a value that fits the map to create a fluent strain map out of this matrix.

  0 Comments

Sign in to comment.

2 Answers

KSSV
Answer by KSSV
on 12 Jun 2019
 Accepted Answer

Read about fillgaps and fillmissing

  2 Comments

Thanks. If I apply
F = fillmissing(A,'linear',2,'EndValues','nearest')
I still get the same matrix, maybe because I only got one horizontal and one vertical as with values?
KSSV
on 12 Jun 2019
Yes....explore it has further options..

Sign in to comment.


Answer by Yoni de Jong on 12 Jun 2019

Can you help me?
I created this code.
True_dist = [0 0.5 1 1.5 2.0];
E_a = [0 8 12 15 17];
E_b = [0 11 13 14 17];
E_c = [0 9 13 16 16];
E_d = [0 10 12 15 17];
x_a = True_dist;
v_a = E_a;
xq_a = True_dist(1):0.1:True_dist(end);
Y_a = interp1(x_a,v_a,xq_a,'poly9');
x_b = True_dist;
v_b = E_b;
xq_b = True_dist(1):0.1:True_dist(end);
Y_b = interp1(x_b,v_b,xq_b,'poly9');
x_c = True_dist;
v_c = E_c;
xq_c = True_dist(1):0.1:True_dist(end);
Y_c = interp1(x_c,v_c,xq_c,'poly9');
x_d = True_dist;
v_d = E_d;
xq_d = True_dist(1):0.1:True_dist(end);
Y_d = interp1(x_d,v_d,xq_d,'poly9');
figure();
plot(x_a,v_a,'or');hold on;
plot(xq_a,Y_a,':r'); hold on;
plot(x_b,v_b,'ob');hold on;
plot(xq_b,Y_b,':b'); hold on;
plot(x_c,v_c,'ok');hold on;
plot(xq_c,Y_c,':k'); hold on;
plot(x_d,v_d,'om');hold on;
plot(xq_d,Y_d,':m'); hold on;
legend('Location a','interpolated a', 'location b', 'interpolated b', 'location c', 'interpolated c', 'location d', 'interpolated d')
xlabel('True distance along path')
ylabel('Real strain on silicone sheet [%]')
Matrix = NaN(41,41)
Matrix(:,21) =[fliplr(Y_a)'; Y_c(2:end)']
Matrix(21,:) = [fliplr(Y_d)'; Y_b(2:end)']
With this matrix i want to use
figure()
image
imagesc(Matrix)
colorbar
to create a heat colormap of this. Something like the figure in the attachement.
However, since I only got values for one row and one horizontal axis in the matrix, i need values for in between (voor the NaNs). However, this will not manage. Can you help me?

  0 Comments

Sign in to comment.