Home Forums GENERAL Overlap integral inside Matlab component

• Author
Posts
• #43415
Shayma Akram
Participant

Hello,
I have interfaced Optisystem with Matlab, I want to know how to calculate the overlap integral using the data of the Inputport structure, inside Matlab component?

###### Attachments:
• #43417
Damian Marek
Participant

This is basically a numerical integration of the electric field distribution of the input signal. The input signal’s field distribution is found under “InputPort1.Sampled.Spatial.ModeX.Amplitude”. If this is your first time with the Matlab component please go through all of the material on our website like the youtube videos etc. on the subject.

• #43419
Shayma Akram
Participant

I have already collected the electric field distribution from InputPort1.Sampled.Spatial.ModeX.Amplitude, but I want to know how to calculate the Overlap Integral from the “InputPort1.Sampled.Spatial.ModeX.Amplitude” in Matlab. Is it by using trapz() function in Matlab?

• #43422
Damian Marek
Participant

Exactly use trapz function

• #43423
Shayma Akram
Participant

could you please check the following code:

xc = linspace(0,1,M); yc = linspace(0,1,M);

 A = E1 .* E2; B = (trapz(xc,trapz(yc, abs(A))) ).^2; C = trapz(xc,trapz(yc, abs(E1).^2)) * trapz(xc,trapz(yc, abs(E2).^2 )); 

OI = B./C;