Тёмный

Solving a second order differential equation in Matlab. Code in description 

Anselm Griffin
Подписаться 4,7 тыс.
Просмотров 7 тыс.
50% 1

This is a detailed example of how to solve a second order differential equation in Matlab using ODE45. For details see bit.ly/3u08ta5

Опубликовано:

 

21 сен 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7   
@PrabhjotKaur-wn3yu
@PrabhjotKaur-wn3yu 2 года назад
Error - Not enough input arguments in this code
@AnselmGriffin
@AnselmGriffin 2 года назад
Send me the code please and I will have a look. Please send script and function please.
@AnselmGriffin
@AnselmGriffin 2 года назад
Send me the code please and I will have a look. Please send script and function please.
@PrabhjotKaur-wn3yu
@PrabhjotKaur-wn3yu 2 года назад
@@AnselmGriffin Can you please share your mail id,so that i can discuss my code with you.
@PrabhjotKaur-wn3yu
@PrabhjotKaur-wn3yu 2 года назад
@@AnselmGriffin clearvars; syms G M r(t) theta(t) t Y; dr = diff(r); d2r = diff(r,2); dtheta = diff(theta); d2theta = diff(theta,2); Eq1= d2r == (((r.^3).*dtheta^2)-G.*M)./(r.^2); Eq2= d2theta == -(2.*dr.*dtheta)./r; [VF,Subs] = odeToVectorField(Eq1,Eq2); ftotal = matlabFunction(VF,'Vars',{t,Y,G,M}); G=4.5183e-24; M=14*10^13; % Choose Appropriate Simulation Time % tspan=linspace(-6.3420e-06,6.3420e-06,500); tspan=linspace(-3.1540e+09,3.1540e+09,500) ic = [200 0 0 0]; % Choose Appropriate Initial Conditions [t,theta] = ode45(@(t,theta) ftotal(t,theta,G,M), tspan, ic); [t,r] = ode45(@(t,r) ftotal(t,r,G,M), tspan, ic); % Angle=theta*(180/pi); % x=r.*cos(theta); % y=r.*sin(theta); figure plot(t,r,'o') hold on plot(t,theta,'o') % hold off xlabel('time') ylabel('Result') grid legend(string(Subs)) X=[t r theta] % B=array2table(X) % B.Properties.VariableNames(1:17)={'t1','r1','r2','r3','r4','theta1','theta2','theta3','theta4','x1','x2','x3','x4','y1','y2','y3','y4'}; %csvwrite('spreadsheet.csv',X)
@PrabhjotKaur-wn3yu
@PrabhjotKaur-wn3yu 2 года назад
@@AnselmGriffin please help me in this code ...its showing NAN values
Далее
How to Solve Differential Equations in PYTHON
23:37
Просмотров 98 тыс.
Lec13 Solving ODEs using ode45 in Matlab
40:37
Просмотров 45 тыс.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
Matlab Tutorial - 58 - Taking Limits in Calculus
6:32
100+ Linux Things you Need to Know
12:23
Просмотров 761 тыс.
Example Second-Order ODE: Spring-Mass-Damper
33:00
Просмотров 43 тыс.
The moment we stopped understanding AI [AlexNet]
17:38
Просмотров 625 тыс.