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.

Getting the seconds elapsed during the simulation with Matlab

Please login with a confirmed email address before reporting spam

Good afternoon.

Can anybody help me?

How can I access the seconds elapsed during the simulation?

Which function can help me? and how can I use it? Maybe mpheval or mphglobal?

I want to make a parametric frequency sweep starting at 100Hz and raising the frequency every second elapsed.

1 sec -> 100hz 2 sec -> 110hz 3 sec -> 120hz ....

So I need to get the real time elapsed to evaluate.


1 Reply Last Post 10 dic 2020, 04:08 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 10 dic 2020, 04:08 GMT-5
Updated: 4 years ago 10 dic 2020, 20:42 GMT-5

Hi, Victor. First, you need to define ''Times'' in the study stetting as [t0, dt, t0+dt], and then select a strict time stepping. In the Matlab, you can use '' t1 = mphglobal(model,'t','solnum','end') to access the time of the last step, and then use to ''model.param.set('t0',[num2str(t1) '[s]'])'' to reset the initial time. For each time loop, you can change what you need. But i think you can just use Comsol to achieve the process.

All the best,

Songcai

Hi, Victor. First, you need to define ''Times'' in the study stetting as [t0, dt, t0+dt], and then select a strict time stepping. In the Matlab, you can use '' t1 = mphglobal(model,'t','solnum','end') to access the time of the last step, and then use to ''model.param.set('t0',[num2str(t1) '[s]'])'' to reset the initial time. For each time loop, you can change what you need. But i think you can just use Comsol to achieve the process. All the best, Songcai

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.