Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 26527

using a time dependent function

$
0
0
Hi

I'm trying to use a time dependent boundary condition with matlab. I need to simulate a boundary condition that change in a fixed sampling time, for example, every 15 seconds the value in the boundary condition changes. These values of boundary conditions are in a data file of matlab. I made the following code:

I initialize the variables c = 0 and n =1 in the workspace of matlab

function out = myfunction(t)
global Vector n c; % global variables
load('Data.mat') % load my Vector

if t == c
c = c + 15;
n = n+1;
end

out = Vector(n,1);


the argument of the function is the time (t) of the comsol simulation, but the comsol simulation does not work.
Anyone can say me if the time (t) in comsol is a 1x1 parameter? because in my matlab function I'm trying to compare the time with a 1x1 value, maybe this is causing the error.


kind regards

Geovani

Viewing all articles
Browse latest Browse all 26527

Trending Articles