Question
a = 1
b = 2
c= 3

Let a, b and c be the three integers previously assigned to you. Let q be the three-digit number abc. The shape, y(x), of a c

1. Use the shooting method and MATLABs built-in numerical solver ODE45 to compute y(x) on the interval 0.55x53. (The value o
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:

  • I have provided the properly commented code in both text and image format so you can easily copy the code as well as check for correct indentation.
  • I have provided the output image of the code so you can easily cross-check for the correct output of the code.
  • Have a nice and healthy day!!

CODE TEXT

% defining given variables

a = 1; b = 2; c = 3;

% q = abc, i.e.

q = a*100 + b*10 + c;

% 1. function required for ode45

% for eqn, y'' = -y'/x + (1/x^2 - 1)*y,

% puting, y' = y(2)

% hence, y'' = A - 2*a*w*y(2) - w^2*y(1)

% defining inline function vdp1

vdp1 = @(x,y) [y(2); -y(2)/x + (1/x^2 - 1)*y(1)];

% defining error tollerance to least four significant figures

% i.e 10^-4

opts = odeset('AbsTol',1e-4);

% using vdp1 , initial values and tollerance

% solving eqn by ode45, it returns x [y y']

[x,Y] = ode45(vdp1,[0.5 3],[0.7145*q; q],opts);

% 2. Ploting curve, x vs y

plot(x,Y(:,1));

xlabel('X');

ylabel('y');

title("Curve for y'' = -y'/x + (1/x^2 - 1)*y");

grid on;

% 3. slopes i.e y'(x) at end points

y_diff = Y(:,2);

fprintf("End point slopes on intervals [0.5 , 3] is: [%.2f, %.2f]", ...

y_diff(1),y_diff(end));

% 4.

% shooting method is good method can find values with low error

% results shown in graph

CODE IMAGE

1 2 a = % defining given variables 1; b = 2; C = 3; % q = abc, i.e. 9 a*100 + b*10 + C; 3 4 - 5 6 7 8 9 10 11 - % 1. function

OUTPUT IMAGE

Curve for y = -ylx + (1/x2 - 1)*y 200 180 160 >140 120 100 80 0.5 1 1.5 2 2.5 3 X

Add a comment
Know the answer?
Add Answer to:
a = 1 b = 2 c= 3 Let a, b and c be the three...
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