Create a parabolic reflector on the left side of a 200 by 200 grid
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I would like to create a parabolic reflector on the left side of a 200 by 200 grid.
I need some ideas on how to implemt it.
The 200 by 200 grid has this
Row 1 numbering: 1 to 200
Row 2 numbering 201 to 400
Row 3 numering: 401 to 600
etc
I have to use this format as I will create a text file of voltage nodes to run in Pspice.
The parabolic reflector will be fixed at 0 volts.
I have created the 200 by 200 grid and put squres in there that are fixed at 0V.
Here is an example of where I am at - all straight lines:
Thanks
2 个评论
Walter Roberson
2025-4-13
reflectorIdx = reshape(1:200*200, 200, []).';
will create a 200 x 200 matrix with entries 1 2 3 ... 200, then 201 202 203 ... 400, and so on.
采纳的回答
Shishir Reddy
2025-7-22
Hi Andrew
As you have already created the 200×200 grid and set up fixed voltage nodes, refer the following steps to create a parabolic reflector on the left side.
Since you want it on the left side, you'll calculate the corresponding x-position (column index) for each y, and round it to the nearest integer grid position. Then, convert that (row, col) to your linear node index using -
nodeIndex = (row - 1) * 200 + col;
Sample MATLAB code -
a = 0.0015;
y0 = 100;
parabola_nodes = [];
for row = 1:200
y = row;
x = round(a * (y - y0)^2) + 1;
if x <= 200
nodeIndex = (row - 1) * 200 + x;
parabola_nodes(end+1) = nodeIndex;
end
end
V = ones(200*200, 1) * NaN;
V(parabola_nodes) = 0;
This will give you a smooth parabolic curve on the left side of the grid. You can then write these node voltages to a text file for PSpice.
I hope this helps.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Create System Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!