Not getting the output. Please Help?

1 visualizzazione (ultimi 30 giorni)
Saad Salman
Saad Salman il 30 Apr 2014
Commentato: José-Luis il 30 Apr 2014
function [X_symbolic, X_mat, X_gau] = Linsys(A,b)
choice = menu('Please select a solution method from the following:', 'Symbolic Math', 'Matrix Algebra', 'Gaussian Elimination');
switch choice case 'Symbolic Math' tic
Force_Ax = sym('1 + F_AC - F_AB*(4/(2*sqrt(5))) = 0')
Force_Ay = sym('1 - F_AB*(2/(2*sqrt(5))) = 1')
Force_Bx = sym('F_AB*(4/(2*sqrt(5))) - F_BD*(4/(2*sqrt(5))) - F_BC*(2/(2*sqrt(2))) = 0')
Force_By = sym('F_AB*(2/(2*sqrt(5))) - F_BD*(2/(2*sqrt(5))) + F_BC*(2/(2*sqrt(2))) = 2')
Force_Cx = sym('F_CE - F_AC + F_BC*(2/(2*sqrt(2))) + F_CD*(2/(2*sqrt(5))) = 0')
Force_Cy = sym('F_CD*(4/(2*sqrt(5))) - F_BC*(2/(2*sqrt(2))) = 0')
Force_Dx = sym('F_BD*(4/(2*sqrt(5))) - F_DF*(4/(2*sqrt(5))) - F_DE*(2/(2*sqrt(2))) - F_CD*(2/(2*sqrt(5))) = 0')
Force_Dy = sym('F_BD*(2/(2*sqrt(5))) + F_DE*(2/(2*sqrt(2))) - F_CD*(4/(2*sqrt(5))) - F_DF*(2/(2*sqrt(5))) = 2')
Force_Ex = sym('F_EH - F_CE + F_DE*(2/(2*sqrt(2))) - F_EG*(2/(2*sqrt(2))) = 0')
Force_Ey = sym('F_EF - F_DE*(2/(2*sqrt(2))) - F_EG*(2/(2*sqrt(2))) = 0')
Force_Fx = sym('F_DF*(4/(2*sqrt(5))) - F_FG*(4/(2*sqrt(5))) = 0')
Force_Fy = sym('F_DF*(2/(2*sqrt(5))) + F_FG*(2/(2*sqrt(2))) - F_EF = 1.75')
Force_Gx = sym('F_FG*(2/(2*sqrt(2))) + F_EG*(2/(2*sqrt(2))) - F_GH*(2/(2*sqrt(2))) = 0')
Force_Gy = sym('F_EG*(2/(2*sqrt(2))) + F_GH*(2/(2*sqrt(2))) - F_FG*(2/(2*sqrt(2))) = 1.5')
Force_Hx = sym('F_GH*(2/(2*sqrt(2))) - F_EH = 0')
Force_Hy = sym('1 - F_GH*(2/(2*sqrt(2))) = 0.75')
[S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,S16] = solve(Force_Ax,Force_Ay,Force_Bx,Force_By,Force_Cx,Force_Cy,Force_Dx,Force_Dy,Force_Ex,Force_Ey,Force_Fx,Force_Fy,Force_Gx,Force_Gy,Force_Hx,Force_Hy)
X_symbolic = [S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,S16]
tic
case 'Matrix Algebra'
tic
X_mat = inv(A)*b
toc
case 'Gaussian Elimination'
tic
X_gau = GEpivot(A,b)
toc
end
  1 Commento
José-Luis
José-Luis il 30 Apr 2014
The way your problem is set up, your program generates only one output, but you are always asking it to produce three.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by