How to create and solve a symbolic equation with an unknown amount of variables?

2 views (last 30 days)
So the question kind of explains it. I am creating a function to solve for the deflection curve of a beam that can be subject to any amount of loadings or supports. So far I've run into a problem solving for the reaction forces at each support. These forces will only be in the y direction so I will have to use ΣR = 0, and with n being an arbitrary point and multiple n's potentially being neccessary to generate enough equations to allow for solutions at each support.
I first collect from the user the amount of supports and information about each
support = struct;
for n = 1:nSup
support(n).type = input(['Enter the type of support for support ' num2str(n) ', (1 for a fixed support, 2 for a pin, and 3 for a roller): ']);
support(n).x = input('Enter distance from the left end of the beam at which the support is located in meters: ');
end
Then ive collected information about each load on the beam
nload = input('Enter number of loads on beam: ');
load = struct;
count = 1;
for n = 1:nload
load(n).type = input(['Enter the type of load for load ' num2str(n) ', (1 for a point load, 2 for a point moment, and 3 for a distributed load): ']);
if load(n).type == 1
load(n).x = input('Enter distance from the left end of the beam at which the load is located: ');
load(n).value = input('Enter force exerted at this location in Newtons: ');
elseif load(n).type == 2
load(n).x = input('Enter distance from the left end of the beam at which the load is located: ');
load(n).value = input('Enter moment exerted at this location in Newtons/meter: ');
elseif load(n).type == 3
load(n).x = input('Enter the location of the distributed load as a vector of the starting x value to the end x value');
load(n).value = input('Enter force exerted at this location in Newtons/meter: ');
load(nload+count).x = [load(n).x(2),L];
load(nload+count).value = -load(n).value;
count = count + 1;
end
end
Ive created duplicate loads in certain areas because to solve for deflection later on, the macaulay equations used for distributed loads must apply to the end of a beam so at the end of a distributed load to counteract that there must be a negative load of the same value.
At this point I create still undetermined loads at each support and these are what I have to solve for
syms R [1,nSup] M [1,count2-1]
I am unsure where to go from here.

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!