Re: Question regarding ode45 solver
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi, I have a question regarding ode45 solver. I have the following code:
function [t,y] = rigid(ip1,tau1)
odeFunction2 = @(t, y) myMainFunction(t, y,ip1,tau1);
[t, y] = ode45(odeFunction2, [0 1500], [0.0,0.0]);
function dydt = myMainFunction(t, y,ip1,tau1)
global N;
dydt = zeros(2,1); % a column vector
dydt(1:N) = (ip1.*heaviside(t-200).*heaviside(400-t)-y(1:N))/tau1 ;
end end
I use the following script to call the function-
global N;
N=2;
ip1=.1*rand(1);
tau1=50;
[T,Y] = rigid(ip1,tau1);
As you can see, this is a 2 dimensional system (with N=2). I would like to create a 2 dimensional array for the parameters ip1 and tau1 in the description of dydt(1:N) =... in function "rigid.m", such that both variables y(1) and y(2) have different parameters ip1 and tau1. Not sure how to implement this. I will appreciate any help in this regard.
Thanks, Lakshmi
0 个评论
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!