看板 MATLAB 關於我們 聯絡資訊
一直無法解決回圈只跑出1組值的問題 50 應該會有50*3 個值 請教大家 感謝大家解惑!!^^ function T=checkpoincarevarycccfinal s=0.005; e=0.25; time=[]; ptt=[]; for j=1:3 c=0.18+0.02*(j-1); x=[1e-6,1e-6,1e-6,1-1e-6]; [t, y]=ode45(@diflv4dhet,[0 8888],x,[],c,s,e); for i=2:length(t) if y(i-1,3) >0.1 && y(i,3) <0.1 w =t(i)+((0.1-y(i,3))*(t(i+1)-t(i))/(y(i+1,3)-y(i,3))) ; %time temp time=[time w]; end end T=time(2:end-1)-time(1:end-2) ; T=T(end-49 : end); end point=[c*ones(1,50);T]; ptt=[ptt point]; end ---------------------------------------- function dydt=diflv4dhet(t,y,c,s,e) dydt =[ y(1)*(1-(y(1)+y(2)+y(3)+y(4))-c*y(2)-s*y(3)+e*y(4)); y(2)*(1-(y(1)+y(2)+y(3)+y(4))-c*y(3)-s*y(4)+e*y(1)); y(3)*(1-(y(1)+y(2)+y(3)+y(4))-c*y(4)-s*y(1)+e*y(2)); y(4)*(1-(y(1)+y(2)+y(3)+y(4))-c*y(1)-s*y(2)+e*y(3)) ]; end -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.107.198.122
scome30601:把程式碼直接貼上來,通常得不到解答 04/13 22:58
vincent59:個人覺得貼上來不是不好,只是要清楚說明哪邊卡住。 04/13 23:20