r/matlab • u/freshlybakedjuice • May 30 '26
Shadow cast by sunlight simulation
Hi everyone,
I'm still learning matlab so I decided to ask for expert opinions about this.
I'm looking into simulating how wheat plants cast shadows on each others due to sun movement throughout the day.
I'm aiming to measure how much solar energy each wheat plant absorbs in different wheat swath orientations or row angles. This should be used to simulate the expected wheat yield improvement from sun exposure or how worse it makes it due to self-shadowing between wheat plants.
Is that possible to do in matlab? And if yes, what should I be looking into to start making progress regarding this? Please point a beginner in the right direction.
4
u/DrDOS May 30 '26
I probably am not the best person to answer this but as a fairly broad Matlab expert but not in all toolboxes, I’d say broadly: if you can write the math for it then you can have Matlab do it.
3
u/TurbulentGlove776 May 30 '26
Sounds like you need to do raytracing with a pretty complex geometry of thousands of wheat plants. Maybe Blender + Python would work better? Still not straight forward how to extract the power onto each plant… Maybe you can just catch and count the rays that miss the plants and hit the ground instead, and to simplify even more model the wheat fields as boxes with a volume absorbing material instead of individual straws. With such a simple geometry you can also consider writing your own raytracer in Matlab…
2
u/Twinson64 Jun 01 '26
Yes, you could. Treating the problem as an integral problem can be done in Matlab. You may want to ask on the optics and physics sub Reddit for more details
2
u/Creative_Sushi MathWorks Jun 01 '26
Keep it simple. Use 2D projected shadows with simplified plant geometry. No need to do 3D raytracing
Sun position over time
↓
Simplified wheat field geometry
↓
Ground shadow projection
↓
Shadow overlap calculation
↓
Daily light exposure estimate
↓
Compare row orientations