Numerical Solution of 3rd order nonlinear differential equation

2 views (last 30 days)
oppgave.JPG
This is a excerise that was given. Completely new to matlab, and dont know how to put this in a matrix form?

Answers (2)

Steven Lord
Steven Lord on 13 Oct 2019
See this documentation page and this other documentation page for the techniques you'll need to use to solve this assignment. If you're completely new to MATLAB and what's written on those pages doesn't make sense, you may want to take the free MATLAB Onramp tutorial first.

Hodan Gesod
Hodan Gesod on 15 Oct 2019
Hey- to Dariva, kind of deleted the wrong comment. What was the mistake I made in the code I'd written?
y0 = [10; 10; 10]; %initial conditions
h= 0.0001; %sampling time
t0=0; %start time
tfinal= 20; %final time
function dydt = f(t,y)
dydt = [ (10*y(2)-10*y(1))
(28*y(1)-y(3)-y(2))
(y(1)*y(2)-(8/3)*y(3)) ];
function yout = ode1(f,t0,h,tfinal,y0);
y=y(0);
yout=y;
for t=t0:h:tfinal-h
s= f(t,y); %slope
y= y+h*s; %euler step
yout= [yout; y];
plot(t,y)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!