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
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.
Andrew
Andrew 2025-4-14
移动:Walter Roberson 2025-4-14
Hi Walter,
Thanks for that.
I have my 200 by 200 grid. I need some help to create a parabolic shape on the
left side boundary. Here is a small video I have created with a 200 by 200 grid
Thanks
Andrew Thorburn

请先登录,再进行评论。

采纳的回答

Shishir Reddy
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 CenterFile Exchange 中查找有关 Create System Objects 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by