Homework matlab for numerical methods, Exercises of Numerical Methods in Engineering

Hw matlab code numerical methods

Typology: Exercises

2020/2021

Uploaded on 12/07/2021

vvv-ttt
vvv-ttt 🇺🇸

6 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Problem set 9
2
6.
w0=40;
L=3;
I=0.0002;
E=150*10^9;
f=@(x,th) (w0/(120*E*I*L))*(-5*x^4+6*L^2*x^2-L^4);
[x1,TH]=system(f,[0,3],0,0.1);
x= 0:0.01:3;
y=(3.704*10^-9)*(-x.^5+18*x.^3-81*x);
plot(x1,TH,x,y);
xlabel ('Distance along beam (m)')
ylabel ('Deflection (m)')
title('Distance along beam vs Deflection')
legend('Euler approx','Analytical solution')
function [t,y]=system(Func,Tspan,Y0,h)
t0=Tspan(1);
tf=Tspan(2);
N=(tf-t0)/h;
y=zeros(length(Y0),N+1);
pf3

Partial preview of the text

Download Homework matlab for numerical methods and more Exercises Numerical Methods in Engineering in PDF only on Docsity!

Problem set 9 2

w0=40; L=3; I=0.0002; E=15010^9; f=@(x,th) (w0/(120EIL))(-5x^4+6L^2x^2-L^4); [x1,TH]=system(f,[0,3],0,0.1); x= 0:0.01:3; y=(3.70410^-9)(-x.^5+18x.^3-81x); plot(x1,TH,x,y); xlabel ('Distance along beam (m)') ylabel ('Deflection (m)') title('Distance along beam vs Deflection') legend('Euler approx','Analytical solution') function [t,y]=system(Func,Tspan,Y0,h) t0=Tspan(1); tf=Tspan(2); N=(tf-t0)/h; y=zeros(length(Y0),N+1);

y(:,1)=Y0; t=t0:h:tf; for i=1:N y(:,i+1)=y(:,i)+h*Func(t(i),y(:,i)); end end

w0 = 40; L = 3; E = 15010^9; I = 0.0002; f=@(x) (w0/(120EIL))(-5x.^4+6L^2x.^2-L^4);