How to create equally spaced complex points

1 view (last 30 days)
Hello,
I have to place 49 equally spaced points in A+jB form in a 100x100 space and write them in an array. For that purpose I first divided the 100x100 space in 7 equal parts both vertically and horizontally by using "linspace" command and then I tried to create the array with "for" loops but it doesn't work. Here's my code below, I hope someone can help me on this. Thanks in advance.
A=linspace(0,100,7);
B=linspace(0,100,7);
for k=1:7
for i=1:7
for l=1:49
S=A(k)+j*B(i)
if true
% code
end
S(l)=S;
end
end
end

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 23 Feb 2014
A=linspace(0,100,7);
B=linspace(0,100,7);
[aa,bb]=ndgrid(A,B)
out=aa+j*bb

More Answers (0)

Community Treasure Hunt

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

Start Hunting!