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.

how to assign a value to the wavelength in matlab script?

Please login with a confirmed email address before reporting spam

I bulit a RF modle with wavelength as physical variable. Now I save it as a M-file in matlab. The problem is how can I assign a value to the wavelength?

I wrote it as following (main part), but it did not work.

-----------------------

a = 0.5;

% Application mode 1
clear appl
appl.mode.class = 'InPlaneWaves';
appl.name = 'rfweh';
appl.module = 'RF';
appl.sshape = 2;
appl.assignsuffix = '_rfweh';
clear prop
prop.field='TES';
prop.inputvar='lambda';
appl.prop = prop;
clear bnd
bnd.type = {'SC','cont'};
bnd.ind = [1,1,1,2,1,2,1,2,1,2,2,2,2,1,2,1,2,2,2,2,1,1,1,1,2,2,2,2,2,2, ...
2,2];
appl.bnd = bnd;
clear equ
equ.coordOn = {{1;1},{1;0},{0;1},{0;0},{0;0}};
equ.epsilonr = {1,1,1,1,3};
equ.Stype = {'coord','coord','coord','none','none'};
equ.ind = [1,2,1,3,4,3,1,2,1,5];
appl.equ = equ;
appl.var = {'lambda0','a'};
fem.appl{1} = appl;
fem.frame = {'ref'};
fem.border = 1;
clear units;
units.basesystem = 'SI';
fem.units = units;

---------------------------

But if I change the 'a' to '0.5', it works.

How can I assign a self-defined variable to the wavelength and bulit a loop using the script language?

0 Replies Last Post 27.01.2011, 10:39 GMT-5
COMSOL Moderator

Hello Zhe Wang

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.