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 10 avr. 2012, 11:08 UTC−4
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 31 oct. 2011, 17:10 UTC−4
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 31 oct. 2011, 20:56 UTC−4
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 17 févr. 2012, 03:42 UTC−5

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 17 févr. 2012, 16:18 UTC−5
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 10 avr. 2012, 11:08 UTC−4
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.