Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
intermediate derivative values for ode15s
Posted:
Jul 8, 2012 3:05 AM
|
|
Hello, I need to solve a set of differential equations and would like to get the values of the derivatives at respective timesteps along with the default integrated output. I tried searching it in the Matlab discussion forum and found a way to use Mass matrix. I defined it as a 4x4 with zeros filling last row and column. But i get an error saying that my index is not '1'. Is there a workaround? It would be really great if i could get any help. My code reads as below:
Main: tspan=[0:0.1:2*pi]; y0=[0 0 0]; [T,tor]=ode15s(@modified_BW_torsional,tspan,y0); torque_2=((c_t1*(dtor(3)-dtor(2))+k_t1*(tor(3)-tor(2))+alpha_t*tor(1))/1);
where dtor is the derivative value at respective timesteps.
function dtor= modified_BW_torsional(t,tor) k_t0=200; tor(3)=5*sin(t); dtor=zeros(3,1); dtor(3)=5*cos(t); dtor(1)=(dtor(3)-dtor(2))*(A_t-(gamma_t+beta_t*sign(dtor(3)-dtor(2))*sign(tor(1)))*abs(tor(1))^n_t); dtor(2)=(c_t1*dtor(3)+k_t1*tor(3)-(k_t0+k_t1)*tor(2)+alpha_t*tor(1))/(c_t0+c_t1); end
|
|
|
|