Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

spatially dependent refractive index

Please login with a confirmed email address before reporting spam

Hi

I was simulating a response of a structure with an incident plane wave. I am saving the code as m-file and running it from matlab (linked with comsol)

I am trying to define a spatially dependent refractive index for a subdomain. I understand that I can do it in the following manner:


n2_str= '4* ( (x<=200e-9)* (y>=170e-9)*(y<=230e-9)) +1';
% Scalar expressions
fem.expr = {'n1','1', ...
'n2',n2_str, ...
'n3','4'};



But what if the spatial dependence can not be expressed as any equation form? For example, I have a matrix with 0's and 1's which essentially defines the positions of 2 materials with 2 different refractive indices. What should I do in this case?


And, is it possible to call a matlab function to define 'n2' instead of putting in an expression in the form of a string?


Thanks
--
Ryyan


0 Replies Last Post 22 août 2011, 13:29 UTC−4
COMSOL Moderator

Hello Mohammad Khan

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.