Info

This question is closed. Reopen it to edit or answer.

How to replace the values of a Matrix

1 view (last 30 days)
Ricardo Gutierrez
Ricardo Gutierrez on 28 Feb 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
Good Morning. Waiting for your valuable help. How to replace the values obtained in D in the matrix A and so on and that this is done 5 times.
clc; clear; close all
A=[0 0.84 1.62 2.19 2.69 3.56 4.55 5.11 5.95 6.94;
0 0.71 1.61 2.19 2.87 3.83 4.79 5.62 6.56 7.06;
0 0.93 1.49 2.48 3.15 3.73 4.27 4.86 5.77 6.76];
B=[0 0.84 1.62 2.19 2.69 3.56 4.55 5.11 5.95 6.94;
0 0.71 1.61 2.19 2.87 3.83 4.79 5.62 6.56 7.06;
0 0.93 1.49 2.48 3.15 3.73 4.27 4.86 5.77 6.76];
C=A+B;
D=2.*C
Thank you
  2 Comments
Ricardo Gutierrez
Ricardo Gutierrez on 28 Feb 2018
Hi. Thanks for addressing this doubt. If we introduce the values of matrices A and B to MatLab, we will obtain the value of D
0 3.3600 6.4800 8.7600 10.7600 14.2400 18.2000 20.4400 23.8000 27.7600
0 2.8400 6.4400 8.7600 11.4800 15.3200 19.1600 22.4800 26.2400 28.2400
0 3.7200 5.9600 9.9200 12.6000 14.9200 17.0800 19.4400 23.0800 27.0400
Now these values obtained replace them with the values that A and solve the operations C = A + B; and D = 2. * C obtain other values of D and these in turn replace the values that A had and repeat the process 5 times. I hope I have explained better. Thank you

Answers (1)

Fangjun Jiang
Fangjun Jiang on 28 Feb 2018
Is this what you want?
A=rand(3,10);
B=rand(3,10);
C=A+B;
D=2.*C;
for k=1:5
A=D;
C=A+B;
D=2.*C;
end
  1 Comment

Community Treasure Hunt

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

Start Hunting!

Translated by