Solving a set of linear equations using vectorization
Mostra commenti meno recenti
We have been given a beam with a varying load condition and told that there is an applied load which starts at 0m and is moved in increments of 1m up to 40m. We have There are also 3 supporing beams. What we have to do is find the values of the support reactions at each point.
These are the three equations that were given. F(1), F(2) and F(3) are the three support reactions. P is a constant of 40 000. d is the distance that needs to increment.
F(1) + F(2) + F(3) = −P
10F(1) + 28F(2) + 40F(3) = −dP
144F(1) − 240F(2) + 180F(3) = 0,
I have tried to set up the formula in the form Ax=b. My matrix A = [1 1 1;10 28 40;144 -240 180f]. I am unsure of how to set up my B matrix as the second row needs to keep changing. Oh and the catch is that we arent allowed to use any for or while loops, we must make use of vectorization.
Thanks for helping !
Risposte (2)
Bruno Luong
il 28 Ago 2019
P = 40000;
dP = 0:10:40 % what ever
z = zeros(size(dP));
A = [1 1 1;10 28 40;144 -240 180];
B = [-P+z; -dP; z];
F = A \ B
David Hill
il 28 Ago 2019
A=[1 1 1;10 28 40;144 -240 180];
P=-40000;
F=arrayfun(@(x)mldivide(A,[P,x*P,0]'),0:40,'UniformOutput',false);
This produces a cell array will all your answers if I understood you correctly.
Categorie
Scopri di più su Linear Algebra in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!