| 24小時(shí)熱門(mén)版塊排行榜 |
| 5 | 1/1 | 返回列表 |
| 查看: 799 | 回復(fù): 4 | |||
wcnmaz新蟲(chóng) (小有名氣)
|
[交流]
MATLAB7.0出錯(cuò)了? 已有2人參與
|
|
y(i,6)=-178075801.6*y(i,4)*y(i,5)+490910.1296*y(i,3)*y(i,2)+1128974.05+7481.104004*sin(2.047t); 為什么MATLAB7.0程序運(yùn)行到上面一行出錯(cuò)了?感覺(jué)也沒(méi)什么錯(cuò)誤啊 怎么改,謝謝了 ![]() ODE45_main文件: clc;clear tspan=[0,1]; y0=[0; 0;0;0;0]; [t,y]=ode45('ODE45_fun',tspan,y0); [m,n]=size(y); for i=1:m y(i,6)=-178075801.6*y(i,4)*y(i,5)+490910.1296*y(i,3)*y(i,2)+1128974.05+7481.104004*sin(2.047t); end data=[t,y]; save ODE45_data.txt data -ascii subplot(2,3,1),plot(t,y(:,1)),title('y(1)') Xlabel('t');Ylabel('y'); subplot(2,3,2),plot(t,y(:,2)),title('y(2)') Xlabel('t');Ylabel('y'); subplot(2,3,3),plot(t,y(:,3)),title('y(3)') Xlabel('t');Ylabel('y'); subplot(2,3,4),plot(t,y(:,4)),title('y(4)') Xlabel('t');Ylabel('y'); subplot(2,3,5),plot(t,y(:,5)),title('y(5)') Xlabel('t');Ylabel('y'); subplot(2,3,6),plot(t,y(:,6)),title('y(6)') Xlabel('t');Ylabel('y'); grid on ODE45_fun文件: function dy=ODE45_fun(t,y) dy(1)=-1.918298553*y(3)*y(4)-121.6697369*y(5)*y(2)+0.006472085*y(2)*y(2)+15.25250926*y(5)*y(5)-0.518363603*sin(2.047t)+0.001124759; dy(2)=0.007229182*y(5)*y(1)-0.013867729*y(3)-0.005151943*sin(2.047t)+33.43424564*y(4)*y(5)-0.092169794*y(3)*y(2)-0.698266828; dy(3)=72.10986245*y(2)+0.52129529*y(4)*y(1)+0.025471074*y(3)+921.886526*y(4)/y(1)-0.47870471*y(4)+0.025471074*y(1)*t-0.38220722*cos(2.047t)-4.62279911; dy(4)=-57.37263009*y(5)+0.001053501*y(3)*y(1)+20.28825016/y(1)-0.001053501*y(3)+0.064741605*y(4)+20.28825016*t-0.006201915*sin(2.047t)-3651.904822; dy(5)=0.017284293*y(4)+0.00278644*y(1)*y(2)-0.551218454*y(2)*y(5)*y(5)+0.010839281*y(2)*y(2)*y(5)+0.020353114*cos(2.047t)+0.110594984; dy=[dy(1);dy(2);dy(3);dy(4);dy(5)]; |
新蟲(chóng) (初入文壇)
新蟲(chóng) (小有名氣)
|
謝謝回答了 2.047*t了,這一行還是出錯(cuò)啊 y(i,6)=-178075801.6*y(i,4)*y(i,5)+490910.1296*y(i,3)*y(i,2)+1128974.05+7481.104004*sin(2.047*t); 還有:[t,y]=ode45('ODE45_fun',tspan,y0); 沒(méi)有錯(cuò)誤吧 Warning: Failure at t=5.501826e-001【【【【y0=換不同的初始值,F(xiàn)ailure at t不同】】】】. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t. the smallest value allowed怎么設(shè)置大一些?可以犧牲一些準(zhǔn)確度 ODE45_main文件: clc;clear tspan=[0,180]; y0=[1e-5;1e-5;1e5;1e-5;1e-5]; [t,y]=ode45('ODE45_fun',tspan,y0); [m,n]=size(y); for i=1:m y(i,6)=-178075801.6*y(i,4)*y(i,5)+490910.1296*y(i,3)*y (i,2)+1128974.05+7481.104004*sin(2.047*t); end data=[t,y]; save ODE45_data.txt data -ascii subplot(2,3,1),plot(t,y(:,1)),title('y(1)') Xlabel('t');Ylabel('y'); subplot(2,3,2),plot(t,y(:,2)),title('y(2)') Xlabel('t');Ylabel('y'); subplot(2,3,3),plot(t,y(:,3)),title('y(3)') Xlabel('t');Ylabel('y'); subplot(2,3,4),plot(t,y(:,4)),title('y(4)') Xlabel('t');Ylabel('y'); subplot(2,3,5),plot(t,y(:,5)),title('y(5)') Xlabel('t');Ylabel('y'); subplot(2,3,6),plot(t,y(:,6)),title('y(6)') Xlabel('t');Ylabel('y'); % plot(t,y(:,1),'bo',t,y(:,2),'rx',t,y(:,3),'gv',t,y(:,4),'r-'); grid on ODE45_fun文件: function dy=ODE45_fun(t,y) dy(1)=-1.918298553*y(3)*y(4)-121.6697369*y(5)*y(2)+0.006472085*y(2)*y(2)+15.25250926*y(5)*y(5)-0.518363603*sin(2.047*t)+0.001124759; dy(2)=0.007229182*y(5)*y(1)-0.013867729*y(3)-0.005151943*sin(2.047*t)+33.43424564*y(4)*y(5)-0.092169794*y(3)*y(2)-0.698266828; dy(3)=72.10986245*y(2)+0.52129529*y(4)*y(1)+0.025471074*y(3)+921.886526*y(4)/y(1)-0.47870471*y(4)+0.025471074*y(1)*t-0.38220722*cos(2.047*t)-4.62279911; dy(4)=-57.37263009*y(5)+0.001053501*y(3)*y(1)+20.28825016/y(1)-0.001053501*y(3)+0.064741605*y(4)+20.28825016*t-0.006201915*sin(2.047*t)-3651.904822; dy(5)=0.017284293*y(4)+0.00278644*y(1)*y(2)-0.551218454*y(2)*y(5)*y(5)+0.010839281*y(2)*y(2)*y(5)+0.020353114*cos(2.047*t)+0.110594984; dy=[dy(1);dy(2);dy(3);dy(4);dy(5)]; |
新蟲(chóng) (小有名氣)
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 354求調(diào)劑 +4 | Tyoumou 2026-03-18 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 328求調(diào)劑,英語(yǔ)六級(jí)551,有科研經(jīng)歷 +3 | 生物工程調(diào)劑 2026-03-16 | 10/500 |
|
|
[考研] 08工科 320總分 求調(diào)劑 +5 | 梨花珞晚風(fēng) 2026-03-17 | 5/250 |
|
|
[考研] 0854可跨調(diào)劑,一作一項(xiàng)核心論文五項(xiàng)專利,省、國(guó)級(jí)證書(shū)40+數(shù)一英一287 +8 | 小李0854 2026-03-16 | 8/400 |
|
|
[考研] 0703化學(xué)調(diào)劑 ,六級(jí)已過(guò),有科研經(jīng)歷 +10 | 曦熙兮 2026-03-15 | 10/500 |
|
|
[考研] 285化工學(xué)碩求調(diào)劑(081700) +9 | 柴郡貓_ 2026-03-12 | 9/450 |
|
|
[考研] 藥學(xué)383 求調(diào)劑 +3 | 藥學(xué)chy 2026-03-15 | 4/200 |
|
|
[考研] 機(jī)械專碩325,尋找調(diào)劑院校 +3 | y9999 2026-03-15 | 5/250 |
|
|
[考研] 326求調(diào)劑 +4 | 諾貝爾化學(xué)獎(jiǎng)覬?/a> 2026-03-15 | 7/350 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 0703 物理化學(xué)調(diào)劑 +3 | 我可以上岸的對(duì)?/a> 2026-03-13 | 5/250 |
|
|
[考研] 0703化學(xué)調(diào)劑 290分有科研經(jīng)歷,論文在投 +7 | 膩膩gk 2026-03-14 | 7/350 |
|
|
[考研] 327求調(diào)劑 +6 | 拾光任染 2026-03-15 | 11/550 |
|
|
[考研] 294求調(diào)劑 +3 | Zys010410@ 2026-03-13 | 4/200 |
|
|
[考研] 材料與化工 323 英一+數(shù)二+物化,一志愿:哈工大 本人本科雙一流 +4 | 自由的_飛翔 2026-03-13 | 5/250 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +6 | 邱gl 2026-03-12 | 7/350 |
|
|
[考研] 329求調(diào)劑 +3 | miaodesi 2026-03-12 | 4/200 |
|
|
[考研] 26調(diào)劑/材料科學(xué)與工程/總分295/求收留 +9 | 2026調(diào)劑俠 2026-03-12 | 9/450 |
|
|
[考研] 289求調(diào)劑 +3 | 李政瑩 2026-03-12 | 3/150 |
|