sinus wave with chosen number of variating period

Hi,
I am trying to simulate a refractive index change in a medium, to do that I need to accurately model the evolution of said index with a sinusoidal function with variating period (see picture below for an exemple).
The function is written as n(z)=n0+n1*cos(phi(z)) (n being the index), with phi(z)=alpha/(z+beta), I would expect that fixing beta and calculating alpha for alpha=nT*2*pi*(zmax+beta) (with nT the number of period in the interval from z=0 to z=zmax) would give me a function with nT period but it does not, where did I go wrong?
Thanks

2 Comments

hello
can you share the code and maybe the paper or doc you are refering to
Hello, the code follows the equations :
%%for the figure shared
N=1e6 %increase N for better plot
z=linspace(0,5e-3,N);
n0=1.445;
n1=8e-4;
n=n0+n1*cos(100e-5./(z+1e-6));
%%when trying for a certain amount of periods
N=1000
nT=1000;
z=linspace(0,5e-3,N);
beta=1e-6;
alpha=nT*2*pi*(z(end)+beta);
n=n0+n1*cos(alpha./(z+beta));
I do not get what more I could explain about it, the article will not really be helpful when it comes to answering this question but here it is https://piers.org/pierspublications/PIERS2011SuzhouProceedings04.pdf page 158 of the pdf document, it is focused on the partition integration method for the numerical simulation not on the model of the function applied to z in the cosinus only mentionned once in fig 1.

Sign in to comment.

 Accepted Answer

Ok not sure that is the best way to do it but it works for me :
define phi(z) as alpha*log(z) and dimension alpha the same way as before.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Release

R2024a

Asked:

on 17 Jul 2025

Answered:

on 17 Jul 2025

Community Treasure Hunt

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

Start Hunting!