Question

The ODE in Problem #2 and #3 for an oscillating mass is used to approximate the motion of a pendulum when the angle of displaCan someone quickly help me with this? It is a second ODE question that needs to be answered by using MATLAB or python please.

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

solution 0. =-200-w²Oa let oa da, and daa dar then, dar daz I مجله w²n tay =-2 Anar nai 2 o =-20 0-w²sino et o = and o= n2

Figure 1 File Edit View Insert Tools Desktop Window Help - NE junk2.mxeulersys.mx + clc clear close lam=2.8; w=10.3; to=0; t_

MATLAB script

clc
clear
close
lam=2.8; w=10.3;
t0=0; t_end=5;
y0=[50*pi/180;0];
h=0.01;
fcn1=@(t,xa)[xa(2);-2*lam*xa(2)-w^2*xa(1)];
[t1,y1] = eulersys(t0,y0,t_end,h,fcn1);
fcn2=@(t,x)[x(2); -2*lam*x(2)-w^2*sin(x(1))];
[t2,y2] = eulersys(t0,y0,t_end,h,fcn2);
plot(t1,y1(:,1),t2,y2(:,1))
legend('Problem 2','Problem 3')
xlabel('Time'),ylabel('\theta(t)')

eulersys function

function [t,y] = eulersys(t0,y0,t_end,h,fcn)
m = length(y0);
n = fix((t_end-t0)/h)+1;
t = linspace(t0,t0+(n-1)*h,n)';
y = zeros(n,m);
y(1,:) = y0;
for i = 2:n
% y(i-1,:)
% h*feval(fcn,t(i-1),y(i-1,:))'
y(i,:) = y(i-1,:)+h*feval(fcn,t(i-1),y(i-1,:))';
end

Add a comment
Know the answer?
Add Answer to:
Can someone quickly help me with this? It is a second ODE question that needs to...
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