Create a parabolic reflector on the left side of a 200 by 200 grid
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Andrew
el 12 de Abr. de 2025
Comentada: Andrew
el 23 de Jul. de 2025
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 comentarios
Walter Roberson
el 13 de Abr. de 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.
Respuesta aceptada
Shishir Reddy
el 22 de Jul. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Create System Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!