Computing Matrices with Multiple Variables that are Unknown
이전 댓글 표시
Please utilized following code to optimize solutions for unknown variables. Only need assistance with %Solve Section
%% PS3 - 1A
clear all
%% Givens
L = 10 %in
E = 10 * 10^6 %PSI
w = .5 %in
I = (w^4)/12
%% k1 = k2
j = E*I/(L^3)
k = j * [12 6*L -12 6*L
6*L 4*L^2 -6*L 2*L^2
-12 -6*L 12 -6*L
6*L 2*L^2 -6*L 4*L^2]
%% K
K = [ k(1,1) k(1,2) k(1,3) k(1,4) 0 0
k(2,1) k(2,2) k(2,3) k(2,4) 0 0
k(3,1) k(3,2) (k(3,3) + k(1,1)) (k(3,4) + k(1,2)) k(1,3) k(1,4)
k(4,1) k(4,2) (k(4,3) + k(1,2)) (k(4,4) + k(2,2)) k(2,3) k(2,4)
0 0 k(1,3) k(2,3) k(3,3) k(4,3)
0 0 k(1,4) k(2,4) k(3,4) k(4,4)]
%% U
v1 = 0
%v2 =
v3 = 0
%t1 =
%t2 =
%t3 =
syms v2 t1 t2 t3
U = [v1 t1 v2 t2 v3 t3]'
%% F
q = 10 %lb/in
F1R = 75 %lb RESULTANT FORCE
F3R = 25 %lb RESULTANT FORCE
F1 = F1R - (q*L)/4
F2 = -(q*L)/4
F3 = F3R
M1 = -(q*L^2)/48
M2 = (q*L^2)/48
M3 = 0
F = [F1 M1 F2 M2 F3 M3]'
%%Solve
Solved=solve(K.*U==F,[t1 v2 t2 t3])
vpaSolved = vpa(struct2cell(Solved))
댓글 수: 5
Walter Roberson
2024년 3월 11일
There is no k2
Romualdo Cipro
2024년 3월 11일
You must decide which of the variables you want to prescribe and which you want to solve for:
Solved=solve(K.*U==F,[f1 f3 F1 F3 v1 v2 v3 t1 t2 t3])
f1 and f3 are unknown variables in your code, F1 and F3 are set to numerical values - thus needn't be solved for, v1 and v3 are set to numerical values - thus needn't be solved for.
Romualdo Cipro
2024년 3월 12일
Hi Romualdo,
I modified the code a bit to use all symbolic constants, real variables, and used transpose, .' instead of ctranspose, ' as it seemed that is the intent. The final equation to be solved used element-wise multiplication times, .* with singleton expansion instead of matrix mutliplication mtimes, *; the former results in an obviously inconsistent set of equations. Still can't find a solution.
L = sym(10); %in
E = sym(10) * 10^6; %PSI
%w = .5 %in
w = sym(1)/2;
I = (w^4)/12;
%% k1 = k2
j = E*I/(L^3);
k = j * [12 6*L -12 6*L
6*L 4*L^2 -6*L 2*L^2
-12 -6*L 12 -6*L
6*L 2*L^2 -6*L 4*L^2];
%% K
K = [ k(1,1) k(1,2) k(1,3) k(1,4) 0 0
k(2,1) k(2,2) k(2,3) k(2,4) 0 0
k(3,1) k(3,2) (k(3,3) + k(1,1)) (k(3,4) + k(1,2)) k(1,3) k(1,4)
k(4,1) k(4,2) (k(4,3) + k(1,2)) (k(4,4) + k(2,2)) k(2,3) k(2,4)
0 0 k(1,3) k(2,3) k(3,3) k(4,3)
0 0 k(1,4) k(2,4) k(3,4) k(4,4)];
%% U
v1 = 0;
v3 = 0;
% assume real
syms v2 t1 t2 t3 real
% use transpose
U = [v1 t1 v2 t2 v3 t3].' ;
%% F
q = sym(10); %lb/in
F1R = sym(75); %lb RESULTANT FORCE
F3R = sym(25); %lb RESULTANT FORCE
F1 = F1R - (q*L)/4;
F2 = -(q*L)/4;
F3 = F3R;
M1 = -(q*L^2)/48;
M2 = (q*L^2)/48;
M3 = 0;
% use transpose
F = [F1 M1 F2 M2 F3 M3].' ;
Here's the equation to solve. It appears to not be correctly formulated, just by looking at the first row.
%%Solve
K.*U == F
The preceding equation used element-wise multiplication. Maybe matrix multiplication was intended?
K*U == F
Though these six equations in four unknowns also don't have a solution.
Solved=solve(K*U==F,[t1 v2 t2 t3])
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

