Create a parabolic reflector on the left side of a 200 by 200 grid

조회 수: 5 (최근 30일)
Andrew
Andrew 2025년 4월 12일
댓글: Andrew 2025년 7월 23일
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