Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
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 commentaires
Surendra Ratnu
Surendra Ratnu le 21 Août 2023
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 le 21 Août 2023
Some obvious mixe and match unit : sin and cos take argument in radian not in degree

Connectez-vous pour commenter.

Réponse acceptée

Bruno Luong
Bruno Luong le 21 Août 2023
Modifié(e) : Bruno Luong le 21 Août 2023
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

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by