How can I solve this coupled non-linear differential equation and graph it?
5 ビュー (過去 30 日間)
古いコメントを表示
I have two coupled non-linear differential equations. Please guide me how to solve it using MATLAB. I am a beginner.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1058660/IMG_20220708_095927.jpg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1058665/IMG_20220708_095947.jpg)
a and n are constants. The initial condition are rho = a, omega = 0 and theta = 0. I also need to plot the graph.
0 件のコメント
採用された回答
Sam Chak
2022 年 7 月 8 日
Dear @Avneet
You can start with something like the following. Let us know if the MATLAB code is helpful for a head start.
a = 1;
tspan = [0 10]; % time span
initv = [0 a]; % initial values
[t, x] = ode45(@odefcn, tspan, initv);
plot(t, x, 'linewidth', 1.5), grid on, xlabel('\theta'), legend('\omega', '\rho', 'location', 'best', 'FontSize', 14)
% Type the nonlinear coupled differential equations here
function dxdt = odefcn(t, x)
dxdt = zeros(2, 1);
a = 1.0; % constant
n = 0.5; % constant
dxdt(1) = a*cos(x(1) - t)/x(2); % Eqn 1
dxdt(2) = a*(sin(x(1) - t) - n); % Eqn 2
end
その他の回答 (1 件)
Chunru
2022 年 7 月 8 日
% initial condition cannot be [0, 0] since when rho0=0, you cannot define
% d omega / d theta.
[theta, y] = ode45(@myODE, [0 2*pi], [0 0.1]);
plot(theta, y)
function dy = myODE(theta, y)
a = 1; n= 1;
% y(1) -> omega, y(2) -> rho
dy(1, 1) = a*cos(y(1)-theta)/y(2);
dy(2, 1) = a*(sin(y(1)-theta)-n);
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!