I need some serious help with the following, The discontinuity functions allows
ID: 3564127 • Letter: I
Question
I need some serious help with the following,
The discontinuity functions allows the equation for the deflection of a beam with multiple loadings to be written as a single equation. {x-a}n = (x-a)n if x>=a 0 if x
v = 1/3.190e9 (800x3 - 13.68e6x - 2.5x4 + 2.5(x-120)4 + 600(x-120)3)
where x is also expressed in inches. The beam is 360 inches long and is supported at 0 on the left and 240 inches to the right of 0. There is distributed load of 60 lb/in from 0 to 120 inches. At 360 inches there is a point load of 1200lb. Both loads are acting downward
I am running into some massive problems trying to figure this out using Matlab.
Here is the code that I currently have:
clear;
%Given Information
%simply supported beam with a distributed load and a point load
x=input('Enter Value for Distance From Support A ');
%Distance from Support A in inches
i=0
t=(x-120)^4
r=(x-240)^3
for x=0:722;
i=i+1;
x(i)=(i-1)*0.5;
v(i)=0:725;
if x(i)>=120;
t=(x(i)-120)^4;
end
if x(i)<120;
t=0;
end
if x(i)>=240;
r=(x(i)-240)^3;
end
if x(i)<240;
r=0;
end
end
v(i)=(1/(3.190*10^9))*((800*x(i)^3)-((13.68*10^6)*x(i))-(2.5*x(i)^4)+(2.5*(t))+(600*(r)));
plot (x,v)
Now ideally there should be some sort of sine wave depending on what "x" you use. Right?
Also please explain where my errors are so I know where I am making my mistakes. Thanks for the help, it is appreciated.
Explanation / Answer
here is the corrected code
clc;
clear all;
close all;
%Given Information
%simply supported beam with a distributed load and a point load
x=input('Enter Value for Distance From Support A ');
%Distance from Support A in inches
%t=(x-120)^4;
%r=(x-240)^3;
t = zeros(721);
r=zeros(721);
v=zeros(721);
for i=1:721;
x(i)=(i-1)*0.5;
if x(i)<120;
t(i)=0;
r(i)=0;
elseif x(i)>=240;
r(i)=(x(i)-240)^3;
t(i)=(x(i)-120)^4;
else
t(i)=(x(i)-120)^4;
r(i)=0;
end
v(i)=(1/(3.190*10^9))*((800*x(i)^3)-((13.68*10^6)*x(i))-(2.5*x(i)^4)+(2.5*(t(i)))+(600*(r(i))));
end
plot (x,v)
grid
.............................................................................
your mistakes ..
1) first assign the sizes of arrays you are defigning
2) at many locations you forgot to put t(i) istead of t .. same applies to r
3) read help manual prroperly to use if , elseif and else options
hope this helps
rate me