Question
Write a Mircrosoft Excel VBA code to solve the deflection in the beam numerically. The beam is supported at both ends (deflection zero at both
Write a Mircrosoft Excel VBA code to solve the deflection in the beam numerically. The beam is supported at both ends (deflection zero at both ends)
Use delx= 24 inches (11nodes)
El d2y/dx2= M(x), where E = 29000 ksi, I = 204 in4 , w = 0.167 kip/inch, and L = 240 inches
For uniform loading, M(x) = w/2 (Lx-x2)
***Use the following Code and debug it. (fill in the question marks)
Private Sub CommandButton1_Click() Dim a(20, 20) As Double, delx As Double, EI As Double, x As Double, i As Integer, j As Integer Dim b(20) As Double, y(20) As Double, yanal(20), n As Integer, w As Double, L As Double 'Define values of n, delx, L, EI, w
'Initialize the A matrix For i = 1 To n For j = 1 To n a(i, j) = 0# Next j Next i
'Assemble A matrix 'For i = ??? 'a(???) = -2 a(i, i + 1) = 1 '??? Next i
'Boundary conditions for A matrix 'a(1, 1) = ??? 'a(???) = 1# 'set appropriate b values b(1) and b(n) 'deflection at the boundary
'assemble B matrix entries For i = 2 To 10 'x = ??? ' b(i) = ??? * (L * x - x ^ 2) /??? Next i
'Use this to check your A matrix
'For i = 1 To n 'For j = 1 To n 'Cells(i, j) = A(i, j) 'Next j 'Next i
'Use this to check your B matrix 'For i = 1 To n 'Cells(i, 1) = B(i) 'Next i
'Solve the matrix problem and output y values
'Compare with analytical solution to check results For i = 1 To n 'x = ??? 'yanal(i) = ((w * L * x ^ 3 / 12) - ??? Cells(i, 2) = yanal(i) Next i
End Sub
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started