Question

using matlab thank you3 MARKS QUESTION 3 Background The van der Pol equation is a 2nd-order ODE that describes self-sustaining oscillations in whic

0 0
Add a comment Improve this question Transcribed image text
Answer #1

function dYdT = f(T,Y)
mew =1;

y = Y(1); z = Y(2);
dydt = z;
dzdt = mew*(1-y^2)*z-y;


dYdT = [dydt dzdt];
end

------------------------------------------------------------------------


clear
close all
clc

a = 0; b = 30; % time interval [0 30]
H = [0.25 0.125 0.0625]; % values of h

for j=1:numel(H)
y = [1 1]; %initial conditions [y(0) z(0)] or [y(0) y'(0)]
h = H(j);
t = a:h:b;
n = (b-a)/h;

% Euler's method
for i=1:n
y(i+1,:) = y(i,:) + h.*f(t(i),y(i,:));
end

% y(t) is stored in 1st column, dydt is stored in 2nd column of y

% plotting y(t)
figure
plot(t,y(:,1))
xlabel('t')
ylabel('y(t)')
title(['h = ' num2str(h)])
grid on


% plotting subplots showing y(t) and corresponding dydt
figure
subplot(2,1,1)
plot(t,y(:,1)) %y(t)
title(['h = ' num2str(h)])
ylabel('y(t)')
xlabel('t')
subplot(2,1,2)
plot(t,y(:,2)) % dydt
ylabel('dydt')
xlabel('t')
end

fprintf('The accuracy can be improved by using a smaller step size h \n')

h 0.25 3 -1 -2 -3 20 10 15 25 30

h = 0.125 2.5r 1.5 0.5 0.5 -1 1.5 -2 -2.5 10 15 20 25 30

h 0.0625 2.5 1.5 0.5 0.5 -1 1.5 -2 -2.5 10 15 20 25 30

h 0.25 -2 10 15 20 25 30 -2 10 20 15 25 30

h = 0.125 -2 30 25 20 15 10 -2 30 25 20 15 10

h 0.0625 -2 10 15 20 25 30 -2 10 20 15 25 30

The accuracy can be improved by using a smaller step size h

COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP
~yc~

Add a comment
Know the answer?
Add Answer to:
using matlab thank you 3 MARKS QUESTION 3 Background The van der Pol equation is a 2nd-order ODE that describes self-sustaining oscillations in which energy is withdrawn from large oscillations and fe...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT