필터 지우기
필터 지우기

How do I get ode45 to output the dependent variable value at each time step? I have other material properties in my differential equation that change with temperature, so I must update them with each change in temperature.

조회 수: 2 (최근 30일)
the equation looks like this:
dT/dt = T/cB(T,B) * d/dT( M(T)) * d/dt( B(t))
cB(T) = the specific heat M(T) = the magnetization of the material

채택된 답변

Jonathan Epperl
Jonathan Epperl 2013년 1월 10일
The answer to your topic is that the odefun, i.e. the function you pass to ode45 as in ode45(odefun,tspan,x0) needs include the line
y
as in
function dydt = odefun(t,y)
%[...] code
y
but I don't think that's what you really want to do/know. Could you detail your question? Also, what is B(t), is that another state you're not telling us about, or is that a known function/input?
Is there a closed form of M(T), cB(T,B) that you are using, or is it a look-up table?
  댓글 수: 1
David Campbell
David Campbell 2013년 1월 11일
Thank you for getting back to me so quickly Jonathan.
I've been looking into it, and yes I think you're right, I'm going to have to include a section in the odefun for this.
To answer your question B(t) is a magnetic wave form:
B(t) = -0.5cos((2*pi/5)t) + 0.5 (ie a wave that will go through one full cycle over the time span I will set for this ode45)
I'm not sure what closed form means exactly but M(T,B) and cB(T,B) are both matrices that give the value of M and cB at different T and B. They are calculated by another program I have written, but the matrices I have calculated will definitely cover the temperature and magnetic field ranges that will occur within this differential equation.
Cheers, Oliver

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by