How can i solve initial value ordinary differential equation using matlab ??
    2 ビュー (過去 30 日間)
  
       古いコメントを表示
    
I want to solve four differtial equation and these are shown in picture. Here u,s,p,r are dependent variable and t is the independent variable. W and a are the constant (values are 154 and 44.5 degree). t is the independent variable and varies from 0 to 180 degree. initial condition are u0 = 0.10, so = 0.2025, p0 = 1.4706, r0 = 2.2449. 
5 件のコメント
  Bruno Luong
      
      
 2023 年 8 月 21 日
				Some obvious mixe and match unit : sin and cos take argument in radian not in degree
採用された回答
  Bruno Luong
      
      
 2023 年 8 月 21 日
        
      編集済み: Bruno Luong
      
      
 2023 年 8 月 21 日
  
      I change integration variables to v=u*s and w=u^2*s;
This should work (you need to sort out the discrepency of unit, speccially for t)
W = 154;
a = deg2rad(44.5);
u0 = 0.10;
s0 = 0.2025;
p0 = 1.4706; 
r0 = 2.2449;
v0 = u0*s0;
w0 = u0^2*s0;
y0 = [v0;w0;p0;r0];
sol = ode45(@(t,y) odefun(t,y,a,W),[0 pi],y0);
t = sol.x;
y = sol.y;
v = y(1,:);
w = y(2,:);
p = y(3,:);
r = y(4,:);
u = w./v;
s = v./u;
tdeg = rad2deg(t)
figure
subplot(2,2,1); plot(tdeg, u); xlabel('tdeg'); ylabel('u')
subplot(2,2,2); plot(tdeg, s); xlabel('tdeg'); ylabel('s')
subplot(2,2,3); plot(tdeg, p); xlabel('tdeg'); ylabel('p')
subplot(2,2,4); plot(tdeg, r); xlabel('tdeg'); ylabel('r')
function dydt = odefun(t, y, a, W)
%v = y(1);  % u*s
w = y(2);   % u^2*s
p = y(3);
r = y(4);
sina = sin(a);
cosacost = cos(a).*cos(t);
c =  sina^3./(4*(1+cosacost).^2);
dvdt = c;
dwdt = c.*cos(p);
dpdt = (2*r/W - c*sin(p).^2) ./ (w.*sin(p)) - 1;
drdt = t ./ tan(p);
dydt = [dvdt; dwdt; dpdt; drdt];
end
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

