필터 지우기
필터 지우기

How can i solve initial value ordinary differential equation using matlab ??

조회 수: 3 (최근 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
Surendra Ratnu
Surendra Ratnu 2023년 8월 21일
They are not cross product. It is simply multiplication and d/dt denote the differtiation with respect to t. I attached a picture for the equation. here is u s are the two differtent variable.
Bruno Luong
Bruno Luong 2023년 8월 21일
Some obvious mixe and match unit : sin and cos take argument in radian not in degree

댓글을 달려면 로그인하십시오.

채택된 답변

Bruno Luong
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)
tdeg = 1×13
0 7.9475 21.1057 35.2541 53.2541 71.2541 89.2541 107.2541 125.2541 143.2541 158.1571 171.0410 180.0000
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개)

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by