i want to store the values of bold part for each iteration of i.
1 view (last 30 days)
Show older comments
Maimoona Asad
on 9 Dec 2021
Commented: Image Analyst
on 9 Dec 2021
for i=1:3
for j=1:10
for k=1:10
x3(j,k)=X3(i)+p;
y3(j,k)=Y3(i);
p=k*l;
end
p=0;
Y3(i)=Y3(i)+l;
end
end
0 Comments
Accepted Answer
Image Analyst
on 9 Dec 2021
I don't understand. The right hand size of the equations are being saved into little x3 and little y3 matrices. Of course you're overwriting for each iteration of i, so maybe you want three indexes:
for i=1:3
for j=1:10
for k=1:10
x3(i, j, k) = X3(i) + p;
y3(i, j, k) = Y3(i);
p=k*l;
end
p=0;
Y3(i) = Y3(i) + l;
end
end
2 Comments
Image Analyst
on 9 Dec 2021
What are your initial X3 and Y3 vectors?
What are the values of p, and l ("ell")?
Do you want x3 and y3 to be 3-D arrays where each 2-D plane is just one plane of the 3-D array?
Image Analyst
on 9 Dec 2021
Try this:
p = 0;
l = 2;
X3 = [-7.655; -6.189; -3.251]
Y3 = [1.393; 10.42; 6.639]
x3 = zeros(10, 10, 3);
y3 = zeros(10, 10, 3);
for plane = 1:3
for j = 1 : 10
for k = 1 : 10
x3(j, k, plane) = X3(plane) + p;
y3(j, k, plane) = Y3(plane);
p = k * l;
end
p = 0;
Y3(plane) = Y3(plane) + l;
end
end
x3
y3
More Answers (0)
See Also
Categories
Find more on Detection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!