Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1496
Number of posts: 2176

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
I have a problem with ODE 45 Posted by jee1141 on 31 Mar 2012 at 1:02 AM
hey Guys
i have a problem with ODE i already wrote my program but it doesnt work :(. who can help me
i need to use the TEMP Q and R in every single steps of ode45 and say to it to do that with these new values in the next period of time and also i need to force ode45 to run the function just one time during the period and jump out of function and start with my new values

Global TEMP R Q
dt=0.00001;
time =0:dt:0.05;
gt=linspace(0,0.05,(0.05/dt)+1);
g = gt;

for k=2:length(time)

t=time(k)
i = 1;
[t,y] = ode45(@(t,y) F(t,y,gt,g),[time(k-1) :dt:time(k)],yy0(i,:),options);
yy0(i,:)=y(end,:)
i = i+1;
plot(time(k),real(y(end,1)));

end
----------------------------------------------------
Function fx = F(t,y,gt,g)
Global TEMP R Q
g=interp1(gt,g,t);
fx = zeros(4,1);

if y(1)-y(2)< 20
R=0
Q=0
TEMP=100
Else
Q = f(last(R),last(y1),last(y2))
TEMP = f(last(R),Q)
R = f(last(T))
End

fx=R.y+cos(g)




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.