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

4 visualizzazioni (ultimi 30 giorni)
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 Commenti
Walter Roberson
Walter Roberson il 13 Apr 2025
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 il 14 Apr 2025
Spostato: Walter Roberson il 14 Apr 2025
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

Accedi per commentare.

Risposta accettata

Shishir Reddy
Shishir Reddy il 22 Lug 2025
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.

Più risposte (0)

Categorie

Scopri di più su Create System Objects in Help Center e File Exchange

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by