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.

Interpolation function in v4

Please login with a confirmed email address before reporting spam

Hi all,

In COMSOL v3.5 I use the following commands to define interpolation functions from matlab. However I could not find a way to do the same thing in v4. Is creating a file (spreadsheet, grid, sectionwise) the only way to do this in v4?

Thanks a lot,
Andre

-----


fcns{1}.type='interp';
fcns{1}.name='rho_design';
fcns{1}.method='linear';
fcns{1}.extmethod='const';
fcns{1}.defvars='true';

cellX = cell(1,m);
for i=1:m
cellX{i} = num2str(x(i));
end

cellY = cell(1,n);
for i=1:n
cellY{i} = num2str(y(i));
end

cellF = cell(1,m*n);
for i=1:m*n
cellF{i} = num2str(F(i));
end

fcns{1}.x = cellX;
fcns{1}.y = cellY;
fcns{1}.data = cellF;

5 Replies Last Post Apr 10, 2012, 11:08 a.m. EDT
COMSOL Moderator

Hello Andre Teves

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.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 31, 2011, 5:10 p.m. EDT
hello
did you resolve the problem?
I've the same difficulties
thx
hello did you resolve the problem? I've the same difficulties thx

Jim Freels mechanical side of nuclear engineering, multiphysics analysis, COMSOL specialist

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 31, 2011, 8:56 p.m. EDT
Just use the built-in function generator of v4+. You can define an equation or read from an external file. No need for MATLAB unless you just want to use it.
Just use the built-in function generator of v4+. You can define an equation or read from an external file. No need for MATLAB unless you just want to use it.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 17, 2012, 3:42 a.m. EST

Hi all,

In COMSOL v3.5 I use the following commands to define interpolation functions from matlab. However I could not find a way to do the same thing in v4. Is creating a file (spreadsheet, grid, sectionwise) the only way to do this in v4?

Thanks a lot,
Andre

-----


fcns{1}.type='interp';
fcns{1}.name='rho_design';
fcns{1}.method='linear';
fcns{1}.extmethod='const';
fcns{1}.defvars='true';

cellX = cell(1,m);
for i=1:m
cellX{i} = num2str(x(i));
end

cellY = cell(1,n);
for i=1:n
cellY{i} = num2str(y(i));
end

cellF = cell(1,m*n);
for i=1:m*n
cellF{i} = num2str(F(i));
end

fcns{1}.x = cellX;
fcns{1}.y = cellY;
fcns{1}.data = cellF;


Hello Andre,

Were you able to find a solution that did not imply reading the data from a text file?

Regards,
Armando
[QUOTE] Hi all, In COMSOL v3.5 I use the following commands to define interpolation functions from matlab. However I could not find a way to do the same thing in v4. Is creating a file (spreadsheet, grid, sectionwise) the only way to do this in v4? Thanks a lot, Andre ----- fcns{1}.type='interp'; fcns{1}.name='rho_design'; fcns{1}.method='linear'; fcns{1}.extmethod='const'; fcns{1}.defvars='true'; cellX = cell(1,m); for i=1:m cellX{i} = num2str(x(i)); end cellY = cell(1,n); for i=1:n cellY{i} = num2str(y(i)); end cellF = cell(1,m*n); for i=1:m*n cellF{i} = num2str(F(i)); end fcns{1}.x = cellX; fcns{1}.y = cellY; fcns{1}.data = cellF; [/QUOTE] Hello Andre, Were you able to find a solution that did not imply reading the data from a text file? Regards, Armando

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 17, 2012, 4:18 p.m. EST
No, I'm still using a text file to comunicate with COMSOL. But that works fine for me!
No, I'm still using a text file to comunicate with COMSOL. But that works fine for me!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 10, 2012, 11:08 a.m. EDT
In 4.2a there is a Interpolation, maybe it works for you.
Model>Definitions>Functions>Interpolation
In 4.2a there is a Interpolation, maybe it works for you. Model>Definitions>Functions>Interpolation

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.