How can I pass 2-D meshgridded var into a 3-D matrix?
Show older comments
I need to pass X and Y which are 2-D meshgridded matrices into c the 3-D matrix. where k is a constant and zv is a vector.
Here is my try:
for i = 1:M
c(:,:,i)=exp(1j*k/(2*zv(i))*(X2.^2+Y2.^2));
end
Thanks.
4 Comments
Stephen23
on 21 Jul 2017
@Ezz El-din Abdullah: What is your question?
Ezz El-din Abdullah
on 21 Jul 2017
Steven Lord
on 21 Jul 2017
Show us the sizes of all of X2, Y2, c, and zv as well as the value of M as they are immediately before you enter the loop.
Ezz El-din Abdullah
on 21 Jul 2017
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!