Not getting the output. Please Help?

조회 수: 1 (최근 30일)
Saad Salman
Saad Salman 2014년 4월 30일
댓글: José-Luis 2014년 4월 30일
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
José-Luis
José-Luis 2014년 4월 30일
The way your problem is set up, your program generates only one output, but you are always asking it to produce three.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by