Asked by Robert101
on 16 Sep 2019 at 12:03

c1 = 0.1;

c2 = 0.0001;

L = 5.0;

M = 0.04;

P1 = 1.0e-2;

P2 = 1.0e-5;

for i=1:64

for j=1:64

C1(i,j) = c1 + P1*(0.5-rand);

C2(i,j) = c2 + P2*(0.5-rand);

end

end

for i=1:64

for j=1:64

dfdC1(i,j) = (L/M) - M*(log(1 - C1(i,j) - C2(i,j)) - log(C1(i,j)))/M;

end

end

Answer by Bob Nbob
on 16 Sep 2019 at 12:24

Accepted Answer

dfdc1(i,j) = (L/M) - M*(log(1 - c1(i,j) - c2(i,j)) - log(c1(i,j)))/M;

c1 and c2 are defined as single values (0.1 and 0.0001), but you are trying to index them. I am assuming you want to refer to C1 and C2.

dfdc1(i,j) = (L/M) - M*(log(1 - C1(i,j) - C2(i,j)) - log(C1(i,j)))/M;

Robert101
on 16 Sep 2019 at 12:46

Bob Nbob
on 16 Sep 2019 at 12:48

Robert101
on 16 Sep 2019 at 13:08

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.