필터 지우기
필터 지우기

Plotting a Differential Equation with respect to time.

조회 수: 5 (최근 30일)
Mohammad Ayoub
Mohammad Ayoub 2018년 5월 1일
답변: Ngoc Thanh Hung Bui 2018년 5월 3일
Greetings. I have a non-linear ODE that I want to solve given the parameters. I am familiar with solving ODEs using 'dsolve' and 'ode45' functions, but I do not know how to plot the parameters with respect to time. I have uploaded a picture of my assignment to make things clear, can anyone help me with that? Thank you very much in advance.

답변 (1개)

Ngoc Thanh Hung Bui
Ngoc Thanh Hung Bui 2018년 5월 3일
%% in dsolve you just need to plot the solution with the time, for example:
syms theta(t)
sol = dsolve(...)
t= 0:1:40;
plot(t, sol)
but the given equation contain sin(theta) so there is no analytic solution for it, so dsolve isnt appropriated here
%% in the ode45 function there is a paramether for time, for example:
tspan = 0:1:40;
init = [1 0];
[t,y] = ode45(@pendulum, tspan, init);
plot(t,y)

제품

Community Treasure Hunt

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

Start Hunting!

Translated by